fixes: cleanup things and added a title on every page

This commit is contained in:
Maieul BOYER 2026-01-13 15:41:09 +01:00 committed by Maix0
parent a1a896daf2
commit 9e431e9c6c
9 changed files with 36 additions and 38 deletions

View file

@ -2,7 +2,7 @@ import { showError } from "@app/toast";
import client from "@app/api";
import cookie from "js-cookie";
import { ensureWindowState, isNullish } from "@app/utils";
import { navigateTo } from "./routing";
import { handleRoute, navigateTo } from "./routing";
cookie.remove("pkce");
@ -28,6 +28,7 @@ declare module "ft_state" {
interface State {
user: User | null;
_headerProfile: boolean;
_reloadOnAuthChange: boolean;
}
}
@ -95,6 +96,12 @@ if (!window.__state._headerProfile) {
});
window.__state._headerProfile = true;
}
window.__state._reloadOnAuthChange ??= false;
if (!window.__state._reloadOnAuthChange) {
document.addEventListener("ft:userChange", () => handleRoute());
window.__state._reloadOnAuthChange = true;
}
updateHeaderProfile();
Object.assign(window as any, { getUser, setUser, updateUser, isLogged });