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: "",
|
username: "",
|
||||||
password: "",
|
password: "",
|
||||||
});
|
});
|
||||||
|
const darkRef = inject<Ref<boolean>>("dark");
|
||||||
const onFinish = async (values: any) => {
|
const onFinish = async (values: any) => {
|
||||||
const { signIn, data } = useAuth();
|
const { signIn } = useAuth();
|
||||||
|
|
||||||
let reso: any;
|
|
||||||
try {
|
try {
|
||||||
reso = await signIn(values);
|
await signIn(values, { redirect: true, callbackUrl: "/" });
|
||||||
|
const { data } = useAuth();
|
||||||
await navigateTo({
|
darkRef.value = data.value.user.profile.nightMode;
|
||||||
path: "/",
|
if (darkRef.value) document.body.dataset.theme = "dark";
|
||||||
});
|
await navigateTo();
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e.data) {
|
if (e.data) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
signOut({
|
signOut({
|
||||||
callbackUrl: "/",
|
callbackUrl: "/",
|
||||||
});
|
});
|
||||||
|
const d = inject<Ref<boolean>>("dark");
|
||||||
|
d.value = false;
|
||||||
|
document.body.dataset.theme = undefined;
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<a-typography-title :level="3"> Signed out. 👋 </a-typography-title>
|
<a-typography-title :level="3"> Signed out. 👋 </a-typography-title>
|
||||||
|
Loading…
Reference in New Issue
Block a user