Skip to content

Conversation

@jzgom067
Copy link
Member

@jzgom067 jzgom067 commented Oct 8, 2025

What?

This PR finally starts connecting the frontend to the backend API.

.env File

A .env file was added to specify the backend URL. example.env was also added to help other developers get up to speed, with instructions in the README.

--experimental-https Added

The --experimental-https argument was added to the npm run dev script, so that cookies would work properly when testing locally.

formatApiError Util Function

This 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:

  • Login
  • Sign Up (actual registration + email resend on success)
  • Verify Email
  • Forgot Password
  • Reset Password
  • Dashboard (see below)

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 fetch API works wonders.

Testing?

Some mild testing was done, but surely not much can go wrong for simple implementations like log in and sign up.

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.
@jzgom067 jzgom067 requested review from Copilot and mirmirmirr October 8, 2025 02:54
Copy link
Contributor

Copilot AI left a 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.

Copy link
Member

@mirmirmirr mirmirmirr left a comment

Choose a reason for hiding this comment

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

👍

@mirmirmirr mirmirmirr merged commit 7cd2729 into main-preview Oct 8, 2025
1 check passed
@jzgom067 jzgom067 deleted the auth-api-connection branch October 14, 2025 16:17
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