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
+3 -22
View File
@@ -1,41 +1,22 @@
import useTranslation from "next-translate/useTranslation";
import router from "next/router";
import Link from "next/link";
import { destroyCookie } from "nookies";
import { signOut } from "next-auth/react";
import { logoutClient } from "../../lib/auth/logoutClient";
const ServiceBanner = (props) => {
props = props.props;
let { t, lang } = useTranslation();
const signInButton = () => {
router.push(
`${
router.locale == "cy" ? "/awd/mewngofnodi" : "/auth/signin"
}?callbackUrl=${encodeURIComponent(
window.location.href
)}&error=EmailSignin`
);
};
const handleLogout = (locale) => {
console.info("////////////\n" + "logout" + "\n////////////");
window.localStorage.clear(),
destroyCookie(null, "next-auth.csrf-token"),
{ path: "/" },
destroyCookie(null, "next-auth.callback-url", { path: "/" }),
destroyCookie(null, "pedw_locale", { path: "/" }),
destroyCookie(null, "pinsUser", { path: "/" }),
signOut({
callbackUrl: locale == "cy" ? "/cy/allgofnodi" : "/logout",
});
logoutClient(locale);
};
const portalLogoLink = [
"/myportal/[appealtypes]",
"/newappeal",
"/newappeal/[appealtypes]",
"/myportal/representation",
"/myportal/representation"
];
return (
<div className="servicebanner myportal govuk-!-margin-bottom-4">