Skip to content

Conversation

@naasir0
Copy link
Collaborator

@naasir0 naasir0 commented Oct 19, 2025

This pull request introduces a full authentication flow to the frontend, including login, profile fetching, token storage, and logout, along with supporting infrastructure for local development and mock API testing. The changes are grouped into authentication logic, UI integration, and development tooling.

Authentication logic and infrastructure:

  • Added AuthProvider and useAuth context in frontend/src/AuthProvider.jsx to manage authentication state, fetch user profile, handle token storage, and redirect on logout or unauthorized API responses.
  • Implemented apiClient.js with token storage, automatic Authorization header injection, error handling for 401 responses, and utility functions for token management.

UI integration:

  • Wrapped the app's routes with AuthProvider in App.jsx so authentication state is available throughout the app. [1] [2] [3]
  • Added a profile area to the navigation bar in PageShell.jsx that shows login/logout buttons and user info based on authentication state. [1] [2]
  • Updated the login page to use the new authentication flow, storing tokens and fetching the user profile on successful login. [1] [2]

Development tooling:

  • Added a proxy configuration to vite.config.js for forwarding /api requests to the backend during local development.
  • Provided a standalone mock_api.py server to simulate authentication and profile endpoints for frontend testing without a real backend.

After Login

Screenshot 2025-10-19 164141

After refreshing the page

Screenshot 2025-10-19 164338

@naasir0 naasir0 linked an issue Oct 19, 2025 that may be closed by this pull request
Copy link
Collaborator

@Munazzah-Rakhangi Munazzah-Rakhangi left a comment

Choose a reason for hiding this comment

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

Changes Required – Login & Signup not functional

Tested locally on PR #55. Both Login and Signup buttons are unresponsive — no API request is triggered when clicked. The backend is running correctly (/api/v1/auth/login and /api/v1/auth/signup tested manually), so the issue seems to be on the frontend side — likely with the event handling or form submission logic.

Please:

  • Verify that the form onSubmit handlers are properly wired.
  • Ensure apiPost('/api/v1/auth/login', data) and apiPost('/api/v1/auth/signup', data) are actually being called on click.
  • Add loading and error states so users get feedback during submission.
  • If it’s working correctly on your side, please show me a quick demo during our Tuesday session so we can confirm and close this PR.

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.

6.22) Header user chip → /users/me

3 participants