mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-13 13:01:38 +00:00
postLogoutRedirectUri
This commit is contained in:
@@ -33,8 +33,8 @@ export default async function Page(props: {
|
|||||||
const locale = getLocale();
|
const locale = getLocale();
|
||||||
const t = await getTranslations({ locale, namespace: "logout" });
|
const t = await getTranslations({ locale, namespace: "logout" });
|
||||||
|
|
||||||
const requestId = searchParams?.requestId;
|
|
||||||
const organization = searchParams?.organization;
|
const organization = searchParams?.organization;
|
||||||
|
const postLogoutRedirectUri = searchParams?.post_logout_redirect_uri;
|
||||||
|
|
||||||
const _headers = await headers();
|
const _headers = await headers();
|
||||||
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
||||||
@@ -58,10 +58,6 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
|
|
||||||
if (requestId) {
|
|
||||||
params.append("requestId", requestId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (organization) {
|
if (organization) {
|
||||||
params.append("organization", organization);
|
params.append("organization", organization);
|
||||||
}
|
}
|
||||||
@@ -73,7 +69,10 @@ export default async function Page(props: {
|
|||||||
<p className="ztdl-p mb-6 block">{t("description")}</p>
|
<p className="ztdl-p mb-6 block">{t("description")}</p>
|
||||||
|
|
||||||
<div className="flex flex-col w-full space-y-2">
|
<div className="flex flex-col w-full space-y-2">
|
||||||
<SessionsClearList sessions={sessions} requestId={requestId} />
|
<SessionsClearList
|
||||||
|
sessions={sessions}
|
||||||
|
postLogoutRedirectUri={postLogoutRedirectUri}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</DynamicTheme>
|
</DynamicTheme>
|
||||||
|
@@ -13,11 +13,9 @@ import { isSessionValid } from "./session-item";
|
|||||||
export function SessionClearItem({
|
export function SessionClearItem({
|
||||||
session,
|
session,
|
||||||
reload,
|
reload,
|
||||||
requestId,
|
|
||||||
}: {
|
}: {
|
||||||
session: Session;
|
session: Session;
|
||||||
reload: () => void;
|
reload: () => void;
|
||||||
requestId?: string;
|
|
||||||
}) {
|
}) {
|
||||||
const t = useTranslations("logout");
|
const t = useTranslations("logout");
|
||||||
|
|
||||||
|
@@ -3,18 +3,21 @@
|
|||||||
import { timestampDate } from "@zitadel/client";
|
import { timestampDate } from "@zitadel/client";
|
||||||
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert, AlertType } from "./alert";
|
import { Alert, AlertType } from "./alert";
|
||||||
import { SessionClearItem } from "./session-clear-item";
|
import { SessionClearItem } from "./session-clear-item";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
sessions: Session[];
|
sessions: Session[];
|
||||||
requestId?: string;
|
postLogoutRedirectUri?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function SessionsClearList({ sessions, requestId }: Props) {
|
export function SessionsClearList({ sessions, postLogoutRedirectUri }: Props) {
|
||||||
const t = useTranslations("logout");
|
const t = useTranslations("logout");
|
||||||
const [list, setList] = useState<Session[]>(sessions);
|
const [list, setList] = useState<Session[]>(sessions);
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
return sessions ? (
|
return sessions ? (
|
||||||
<div className="flex flex-col space-y-2">
|
<div className="flex flex-col space-y-2">
|
||||||
{list
|
{list
|
||||||
@@ -34,9 +37,11 @@ export function SessionsClearList({ sessions, requestId }: Props) {
|
|||||||
return (
|
return (
|
||||||
<SessionClearItem
|
<SessionClearItem
|
||||||
session={session}
|
session={session}
|
||||||
requestId={requestId}
|
|
||||||
reload={() => {
|
reload={() => {
|
||||||
setList(list.filter((s) => s.id !== session.id));
|
setList(list.filter((s) => s.id !== session.id));
|
||||||
|
if (postLogoutRedirectUri) {
|
||||||
|
router.push(postLogoutRedirectUri);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
key={"session-" + index}
|
key={"session-" + index}
|
||||||
/>
|
/>
|
||||||
|
Reference in New Issue
Block a user