Fix login on deployment

This commit is contained in:
2024-02-20 16:47:51 -05:00
parent a8dc4d8460
commit 8862f7b94c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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}`,
},