-
Notifications
You must be signed in to change notification settings - Fork 0
Add auth API connections #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The README was updated to include it in the setup instructions.
I'm removing the trailing slash to hopefully suggest to other developers to omit it, just in case it causes issues with the URL.
Adding HTTPS and route redirecting is necessary to get cookies working on local testing.
This stops the user from sending another request while still waiting for one.
If the user put in anything wrong and submitted, they would be locked out of submitting again.
Very rudimentary, but it's just there to have one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR connects the frontend authentication flows to the backend API, replacing mock implementations with actual HTTP requests. The changes enable proper user authentication, registration, email verification, and password management functionality.
- Added environment configuration and HTTPS support for local development
- Implemented API integration for all authentication flows (login, signup, email verification, password reset)
- Created a utility function to format backend error messages for user display
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Added --experimental-https flag to dev script for local HTTPS support |
| next.config.ts | Added API rewrites to proxy backend requests and handle CORS |
| example.env | Added example environment file with API URL configuration |
| app/_utils/format-api-error.tsx | New utility to convert backend JSON errors to user-friendly strings |
| app/login/page.tsx | Replaced mock login with actual API call to /api/auth/login/ |
| app/sign-up/page.tsx | Implemented real registration API call with proper validation |
| app/sign-up/email-sent/page.tsx | Added email resend functionality via API |
| app/verify-email/page.tsx | Replaced mock verification with actual API call |
| app/forgot-password/page.tsx | Implemented password reset request API integration |
| app/reset-password/page.tsx | Added actual password reset API call with token validation |
| app/dashboard/page.tsx | Added temporary logout button with API integration |
| README.md | Added environment setup instructions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
mirmirmirr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
What?
This PR finally starts connecting the frontend to the backend API.
.envFileA
.envfile was added to specify the backend URL.example.envwas also added to help other developers get up to speed, with instructions in the README.--experimental-httpsAddedThe
--experimental-httpsargument was added to thenpm run devscript, so that cookies would work properly when testing locally.formatApiErrorUtil FunctionThis was created to turn the JSON error format from the backend into a single string. This makes it easy to just create an alert from the error message in case something goes wrong. See the implemented API calls for examples.
Actual API Functionality
API functionality was added to the following pages:
Temporary Logout Button
There's no account button (in this branch), so I put a temporary logout button on the dashboard page since there's nowhere else good for it. It will get removed when the account button is added.
Why?
A website is cool and all but what's the point without the backend data to support it?
How?
The
fetchAPI works wonders.Testing?
Some mild testing was done, but surely not much can go wrong for simple implementations like log in and sign up.