Fix Deployment Authentication Problems #18
@@ -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) {
|
||||
|
||||
@@ -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}`,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user