diff --git a/Frontend/src/pages/auth.js b/Frontend/src/pages/auth.js new file mode 100644 index 0000000..58be629 --- /dev/null +++ b/Frontend/src/pages/auth.js @@ -0,0 +1,31 @@ +// auth.js (utility file) + +// Import the required libraries +import axios from 'axios'; + +// Function to check if the user is authenticated based on the backend verification +export async function isAuthenticated(token) { + try { + // make axios get request sending cookie. + const response = await axios.get('http://localhost:5000/api/verify_user', { + headers: { + Authorization: 'Bearer ${token}', // Send the JWT token in the Authorization header + }, + }); + + return response.data.authenticated; + } catch (error) { + // console.error('Error during user verification:', error); + return false; + } +} +const AuthPage = () => { + return ( +
+

You shouldn't have gotten here!

+

This page is not meant to be accessed directly.

+
+ ); +}; + +export default AuthPage; \ No newline at end of file