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
+5 -14
View File
@@ -1,10 +1,8 @@
import { signOut } from "next-auth/react";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { destroyCookie } from "nookies";
import { useState, useEffect } from "react";
import { useIdleTimer } from "react-idle-timer";
import TimeoutModal from "./timeoutmodal";
import { logoutClient } from "../../lib/auth/logoutClient";
const TimeOut = (props) => {
let { t } = useTranslation();
@@ -21,14 +19,7 @@ const TimeOut = (props) => {
const onIdle = () => {
setState("Idle");
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);
setOpen(false);
};
@@ -48,7 +39,7 @@ const TimeOut = (props) => {
onPrompt,
timeout,
promptBeforeIdle,
throttle: 500,
throttle: 500
});
useEffect(() => {
@@ -89,14 +80,14 @@ const TimeOut = (props) => {
<div
className={open ? "modal fade show" : "modal fade"}
style={{
display: open ? "flex" : "none",
display: open ? "flex" : "none"
}}
>
<div className="modal-dialog">
<div className="modal-content">
<h3>
{t("common:login-modal-message", {
remaining: remaining,
remaining: remaining
})}
</h3>
<button