Skip to content

feat:integrate register api fixes #5#18

Open
Nayan-Kute21 wants to merge 4 commits into
HacktoberBlog:mainfrom
Nayan-Kute21:feature/register-api
Open

feat:integrate register api fixes #5#18
Nayan-Kute21 wants to merge 4 commits into
HacktoberBlog:mainfrom
Nayan-Kute21:feature/register-api

Conversation

@Nayan-Kute21

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

Copy link
Copy Markdown
  • 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.

@vercel

vercel Bot commented Oct 1, 2025

Copy link
Copy Markdown

@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
Copy Markdown
Author

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

@NotShrirang

Copy link
Copy Markdown
Contributor

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

@NotShrirang NotShrirang left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/pages/RegisterPage.jsx Outdated

// 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
Copy Markdown
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.

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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.

@NotShrirang NotShrirang left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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