Phase 1 reliability/stabilisation: auth logging, logout client, loader+xml hardening

This commit is contained in:
2026-05-13 10:05:49 +01:00
parent d36a56c4c9
commit 8fe06c09c4
9 changed files with 125 additions and 49 deletions
+27
View File
@@ -0,0 +1,27 @@
import { destroyCookie } from "nookies";
import { signOut } from "next-auth/react";
const AUTH_COOKIE_NAMES = [
"next-auth.csrf-token",
"next-auth.callback-url",
"__Secure-next-auth.callback-url",
"pedw_locale",
"pinsUser"
];
export const clearClientSessionArtifacts = () => {
if (typeof window !== "undefined") {
window.localStorage.clear();
}
AUTH_COOKIE_NAMES.forEach((cookieName) => {
destroyCookie(null, cookieName, { path: "/" });
});
};
export const logoutClient = async (locale) => {
clearClientSessionArtifacts();
await signOut({
callbackUrl: locale === "cy" ? "/cy/allgofnodi" : "/logout"
});
};