auth integration and also making sign in and signup nav bar buttons work#44
auth integration and also making sign in and signup nav bar buttons work#44
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR integrates frontend authentication functionality by connecting existing auth service functions to login/signup forms and implementing session-based navigation. The changes enable end-to-end user authentication with proper error handling and loading states.
- Connected login and signup forms to backend auth service with error handling and loading states
- Updated navbar to display different options based on authentication status (Profile/Logout vs Sign In/Sign Up)
- Enhanced profile page to show session information and authentication-aware content
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| client/src/types/dto/accountDto.ts | Added SignupInput type for extended signup data |
| client/src/services/authService.ts | Fixed API endpoints and updated signup function parameter type |
| client/src/lib/authClient.ts | Updated base URL configuration with fallback |
| client/src/components/Navbar.tsx | Added dynamic navigation based on auth status with logout functionality |
| client/src/app/signup/page.tsx | Connected signup form to auth service with error handling and loading states |
| client/src/app/profile/page.tsx | Made profile page authentication-aware with session display |
| client/src/app/login/page.tsx | Connected login form to auth service with error handling and loading states |
| client/src/app/api/auth/[...nextauth]/route.ts | Fixed API endpoint paths for NextAuth configuration |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| password: values.password, | ||
| }; | ||
|
|
||
| await signup(signupData, "/profile"); |
There was a problem hiding this comment.
[nitpick] The signup function is called with a hardcoded redirect URL '/profile'. Consider making this configurable or using a constant to improve maintainability and flexibility.
| password: values.password, | ||
| }; | ||
|
|
||
| await login(loginData, "/profile"); |
There was a problem hiding this comment.
[nitpick] The login function is called with a hardcoded redirect URL '/profile'. Consider making this configurable or using a constant to improve maintainability and consistency with other parts of the application.
Integrate Frontend Auth Service with Login and Signup Pages
Integrated the existing auth service with login and signup forms to enable end-to-end authentication. Added proper error handling, loading states, and session management.
Changes
Users can now sign up/login through the forms, which calls the backend API to generate JWT tokens. Refresh tokens are stored in httpOnly cookies, access tokens are available via NextAuth session, and automatic token refresh is handled. Logout clears session and redirects appropriately.
Closes #12