Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
promiseonuoha committed Sep 13, 2024
2 parents 8e7defc + fe3b039 commit dbc6d46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/callback/auth/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function ValidateToken() {
if (!response.ok) throw new Error("Failed to fetch user token");

const data = await response.json();
console.log(data)
const userToken = data?.userToken;

// Save the user token as a cookie
Expand All @@ -48,7 +49,7 @@ export default function ValidateToken() {
// Redirect the user after validation
setTimeout(() => {
router.push("/login"); // Redirect to the homepage or any route
}, 1500); // Delay for user feedback
}, 6000); // Delay for user feedback

} catch (error) {
alert("Failed to retrieve user token!"); // Notify the user of failure
Expand Down
2 changes: 2 additions & 0 deletions app/login/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default function Login() {
// Check if the token exists in the cookies
const token = Cookies.get("analogueshifts");

console.log('The User token is' + token)

if (token) {
// If token exists, redirect to /my-resumes
router.push("/my-resumes");
Expand Down
4 changes: 2 additions & 2 deletions app/my-resumes/components/resumes-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function Resumes() {
const fetchUserData = async (token) => {
try {
const res = await fetch("https://api.analogueshifts.app/api/user", {
method: "POST",
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Expand All @@ -40,7 +40,7 @@ export default function Resumes() {
}
};

console.log(fetchUserData)
console.log(user)

if (loading) {
return <p>Loading...</p>; // Display loading state
Expand Down

0 comments on commit dbc6d46

Please sign in to comment.