fix build errors

This commit is contained in:
2025-08-11 02:04:12 +02:00
parent 6cec9f506a
commit 48ca910f83
4 changed files with 13 additions and 16 deletions

View File

@@ -6,10 +6,7 @@ export async function POST(req: NextRequest) {
const { password } = await req.json(); const { password } = await req.json();
if (password !== process.env.PASSWORD) { if (password !== process.env.PASSWORD) {
return NextResponse.json( return NextResponse.json({ error: "Invalid password" }, { status: 401 });
{ error: "Invalid password" },
{ status: 401 }
);
} }
const session = await getSession(); const session = await getSession();
@@ -18,6 +15,7 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ success: true }); return NextResponse.json({ success: true });
} catch (error) { } catch (error) {
console.error(error);
return NextResponse.json( return NextResponse.json(
{ error: "Authentication failed" }, { error: "Authentication failed" },
{ status: 500 } { status: 500 }

View File

@@ -8,10 +8,7 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ success: true }); return NextResponse.json({ success: true });
} catch (error) { } catch (error) {
return NextResponse.json( console.error(error);
{ error: "Logout failed" }, return NextResponse.json({ error: "Logout failed" }, { status: 500 });
{ status: 500 }
);
} }
} }
}

View File

@@ -68,10 +68,7 @@ export async function POST(req: NextRequest) {
sessionOptions sessionOptions
); );
if (!session.authenticated) { if (!session.authenticated) {
return NextResponse.json( return NextResponse.json({ error: "Not authenticated" }, { status: 401 });
{ error: "Not authenticated" },
{ status: 401 }
);
} }
const token = await fetchOidcToken(); const token = await fetchOidcToken();
@@ -81,7 +78,7 @@ export async function POST(req: NextRequest) {
const sessionUrl = apiBase + "/api/merchant/session"; const sessionUrl = apiBase + "/api/merchant/session";
// parse sessionId from request body, handle missing/invalid JSON // parse sessionId from request body, handle missing/invalid JSON
let body: any; let body: { sessionId?: unknown } | undefined;
try { try {
body = await req.json(); body = await req.json();
} catch { } catch {
@@ -124,7 +121,11 @@ export async function POST(req: NextRequest) {
{ status: 500 } { status: 500 }
); );
} }
} catch (err: any) { } catch (error) {
return NextResponse.json({ error: err.message }, { status: 500 }); console.error(error);
return NextResponse.json(
{ error: "An unexpected error occurred" },
{ status: 500 }
);
} }
} }

View File

@@ -8,6 +8,7 @@ export async function GET() {
return NextResponse.json({ authenticated: isAuthenticated }); return NextResponse.json({ authenticated: isAuthenticated });
} catch (error) { } catch (error) {
console.error(error)
return NextResponse.json({ authenticated: false }); return NextResponse.json({ authenticated: false });
} }
} }