mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:07:32 +00:00
listSessions
This commit is contained in:
@@ -12,13 +12,14 @@ import { getLocale, getTranslations } from "next-intl/server";
|
|||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
async function loadSessions() {
|
async function loadSessions(host: string) {
|
||||||
const ids = await getAllSessionCookieIds();
|
const ids: (string | undefined)[] = await getAllSessionCookieIds();
|
||||||
|
|
||||||
if (ids && ids.length) {
|
if (ids && ids.length) {
|
||||||
const response = await listSessions(
|
const response = await listSessions({
|
||||||
ids.filter((id: string | undefined) => !!id),
|
host,
|
||||||
);
|
ids: ids.filter((id) => !!id) as string[],
|
||||||
|
});
|
||||||
return response?.sessions ?? [];
|
return response?.sessions ?? [];
|
||||||
} else {
|
} else {
|
||||||
console.info("No session cookie found.");
|
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({
|
const branding = await getBrandingSettings({
|
||||||
host,
|
host,
|
||||||
|
@@ -362,13 +362,12 @@ export async function deleteSession({
|
|||||||
return sessionService.deleteSession({ sessionId, sessionToken }, {});
|
return sessionService.deleteSession({ sessionId, sessionToken }, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listSessions({
|
type ListSessionsCommand = {
|
||||||
host,
|
|
||||||
ids,
|
|
||||||
}: {
|
|
||||||
host: string;
|
host: string;
|
||||||
ids: string[];
|
ids: string[];
|
||||||
}) {
|
};
|
||||||
|
|
||||||
|
export async function listSessions({ host, ids }: ListSessionsCommand) {
|
||||||
const sessionService: Client<typeof SessionService> =
|
const sessionService: Client<typeof SessionService> =
|
||||||
await createServiceForHost(SessionService, host);
|
await createServiceForHost(SessionService, host);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user