This commit is contained in:
peintnermax
2024-03-21 15:23:32 +01:00
parent a115224c03
commit ca8bcdb676

View File

@@ -9,12 +9,10 @@ import { Session, AuthRequest, Prompt, login } from "@zitadel/server";
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
async function loadSessions(ids: string[]): Promise<Session[]> { async function loadSessions(ids: string[]): Promise<Session[]> {
console.log("loadSessions", ids);
const response = await listSessions( const response = await listSessions(
server, server,
ids.filter((id: string | undefined) => !!id) ids.filter((id: string | undefined) => !!id)
).catch(console.error); );
console.log("sessions:", response);
return response?.sessions ?? []; return response?.sessions ?? [];
} }
@@ -40,6 +38,7 @@ function findSession(
} }
return undefined; return undefined;
} }
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
const searchParams = request.nextUrl.searchParams; const searchParams = request.nextUrl.searchParams;
const authRequestId = searchParams.get("authRequest"); const authRequestId = searchParams.get("authRequest");
@@ -47,6 +46,7 @@ export async function GET(request: NextRequest) {
const sessionCookies: SessionCookie[] = await getAllSessions(); const sessionCookies: SessionCookie[] = await getAllSessions();
const ids = sessionCookies.map((s) => s.id); const ids = sessionCookies.map((s) => s.id);
console.log("sessionIds", ids);
let sessions: Session[] = []; let sessions: Session[] = [];
if (ids && ids.length) { if (ids && ids.length) {
sessions = await loadSessions(ids); sessions = await loadSessions(ids);