listSessions

This commit is contained in:
Max Peintner
2025-01-20 11:55:31 +01:00
parent f535b6da4c
commit 86679f14a0
2 changed files with 11 additions and 11 deletions

View File

@@ -12,13 +12,14 @@ import { getLocale, getTranslations } from "next-intl/server";
import { headers } from "next/headers";
import Link from "next/link";
async function loadSessions() {
const ids = await getAllSessionCookieIds();
async function loadSessions(host: string) {
const ids: (string | undefined)[] = await getAllSessionCookieIds();
if (ids && ids.length) {
const response = await listSessions(
ids.filter((id: string | undefined) => !!id),
);
const response = await listSessions({
host,
ids: ids.filter((id) => !!id) as string[],
});
return response?.sessions ?? [];
} else {
console.info("No session cookie found.");
@@ -50,7 +51,7 @@ export default async function Page(props: {
}
}
let sessions = await loadSessions();
let sessions = await loadSessions(host);
const branding = await getBrandingSettings({
host,

View File

@@ -362,13 +362,12 @@ export async function deleteSession({
return sessionService.deleteSession({ sessionId, sessionToken }, {});
}
export async function listSessions({
host,
ids,
}: {
type ListSessionsCommand = {
host: string;
ids: string[];
}) {
};
export async function listSessions({ host, ids }: ListSessionsCommand) {
const sessionService: Client<typeof SessionService> =
await createServiceForHost(SessionService, host);