From 8862f7b94c3a09e03f0faa1df2274b8d44166f67 Mon Sep 17 00:00:00 2001 From: Nicholas Pease Date: Tue, 20 Feb 2024 16:47:51 -0500 Subject: [PATCH] Fix login on deployment --- frontend-next/src/app/api/onboard/route.js | 2 +- frontend-next/src/middleware.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend-next/src/app/api/onboard/route.js b/frontend-next/src/app/api/onboard/route.js index 0820fc5..a4eab8f 100644 --- a/frontend-next/src/app/api/onboard/route.js +++ b/frontend-next/src/app/api/onboard/route.js @@ -7,7 +7,7 @@ import { getDatabase, ref, set as firebaseSet } from "firebase/database"; async function onboard(firstName, lastName, req) { var session = req.cookies.get("session"); //Call the authentication endpoint - var res = await fetch("http://localhost:3000/api/login", {headers: {Cookie: `session=${session?.value}`}}) + var res = await fetch(new URL("/api/login", req.url), {headers: {Cookie: `session=${session?.value}`}}) // Login if unauthorized if (res.status !== 200) { diff --git a/frontend-next/src/middleware.js b/frontend-next/src/middleware.js index 7029033..abef4f5 100644 --- a/frontend-next/src/middleware.js +++ b/frontend-next/src/middleware.js @@ -10,7 +10,7 @@ export async function middleware(req, res) { return NextResponse.redirect(new URL("/login", req.url)); } //Call the authentication endpoint - const responseAPI = await fetch("http://localhost:3000/api/login", { + const responseAPI = await fetch(new URL("/api/login", req.url), { headers: { Cookie: `session=${session?.value}`, }, -- 2.52.0