Skip to content

Commit

Permalink
git is stupid
Browse files Browse the repository at this point in the history
  • Loading branch information
candywal committed Dec 8, 2023
1 parent 6556ce4 commit a249acf
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Frontend/src/pages/auth.js
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<h1>You shouldn't have gotten here!</h1>
<p>This page is not meant to be accessed directly.</p>
</div>
);
};

export default AuthPage;

0 comments on commit a249acf

Please sign in to comment.