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
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user