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" }); };