logout redirects

This commit is contained in:
Max Peintner
2025-06-05 11:01:35 +02:00
parent db3c2d9729
commit 2efb3c6a62
2 changed files with 8 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ export function SessionsClearList({
const router = useRouter();
async function clearHintedSession() {
console.log("Clearing session for login hint:", loginHint);
// If a login hint is provided, we logout that specific session
const sessionIdToBeCleared = sessions.find((session) => {
return session.factors?.user?.loginName === loginHint;
@@ -35,6 +36,9 @@ export function SessionsClearList({
if (sessionIdToBeCleared) {
const clearSessionResponse = await clearSession({
sessionId: sessionIdToBeCleared,
}).catch((error) => {
console.error("Error clearing session:", error);
return;
});
if (!clearSessionResponse) {
@@ -58,7 +62,9 @@ export function SessionsClearList({
}
useEffect(() => {
clearHintedSession();
if (loginHint) {
clearHintedSession();
}
}, []);
return sessions ? (

View File

@@ -141,7 +141,7 @@ export async function removeSessionFromCookie<T>({
session: SessionCookie<T>;
cleanup?: boolean;
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
}): Promise<any> {
}) {
const cookiesList = await cookies();
const stringifiedCookie = cookiesList.get("sessions");