Skip to content

Conversation

Nayan-Kute21
Copy link

@Nayan-Kute21 Nayan-Kute21 commented Oct 1, 2025

  • This PR implements MyContext to manage authentication and user profile state, persisting both in localStorage so users stay logged in after refresh.
  • The registerAPI was refactored to accept a userData object and send the correct payload to the updated /users/create endpoint.
  • On successful registration, the app now auto-logs in the user by saving their data in context and localStorage, marking them as authenticated, and redirecting to the dashboard.
  • Route guards (ProtectedRoute and PublicRoute) were also updated to read from context instead of static API checks, ensuring consistent authentication handling throughout the app.

Copy link

vercel bot commented Oct 1, 2025

@Nayan-Kute21 is attempting to deploy a commit to the notshrirang's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Nayan-Kute21
Copy link
Author

can you also add the tag of hacktoberfest accepted before merging this pr.

@NotShrirang
Copy link
Contributor

@Nayan-Kute21 Please add a description to this PR.

Copy link
Contributor

@NotShrirang NotShrirang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nayan-Kute21 let's wait till backend implements JWT auth


// Generate a temporary token for demo purposes
// In a real app, the registration API should return a token
const tempToken = `temp_${Date.now()}_${userData.email}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Prathamesh-007 please have a look at this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JWT implementation is in progress. So better to keep token based changes on hold for now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raised a fix.

@NotShrirang
Copy link
Contributor

@Nayan-Kute21 I just merged another PR into the main branch, and now your PR has some merge conflicts. Could you please pull the latest changes from main and resolve the conflicts? Let me know if you need any help.

Copy link
Contributor

@NotShrirang NotShrirang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve the merge conflict.

@Nayan-Kute21
Copy link
Author

@NotShrirang resolved the conflict. I also noticed a rece condition in the registration flow. replaced 'navigate' with 'window.location.replace` to cater it in the registration page. let me know if there are any other changes to be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants