fix(pages, components): fix inconsistent theme when logging in/out

manually set body's `data-theme` attribute to the appropriate value
This commit is contained in:
parent c68762ceac
commit 05a20ff94e
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C
2 changed files with 10 additions and 8 deletions

@ -17,17 +17,16 @@
username: "",
password: "",
});
const darkRef = inject<Ref<boolean>>("dark");
const onFinish = async (values: any) => {
const { signIn, data } = useAuth();
const { signIn } = useAuth();
let reso: any;
try {
reso = await signIn(values);
await navigateTo({
path: "/",
});
await signIn(values, { redirect: true, callbackUrl: "/" });
const { data } = useAuth();
darkRef.value = data.value.user.profile.nightMode;
if (darkRef.value) document.body.dataset.theme = "dark";
await navigateTo();
} catch (e: any) {
if (e.data) {
notification["error"]({

@ -6,6 +6,9 @@
signOut({
callbackUrl: "/",
});
const d = inject<Ref<boolean>>("dark");
d.value = false;
document.body.dataset.theme = undefined;
</script>
<template>
<a-typography-title :level="3"> Signed out. 👋 </a-typography-title>