diff --git a/pages/auth/login.vue b/pages/auth/login.vue index 2d9a612..326079f 100644 --- a/pages/auth/login.vue +++ b/pages/auth/login.vue @@ -17,17 +17,16 @@ username: "", password: "", }); - + const darkRef = inject>("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"]({ diff --git a/pages/auth/logout.vue b/pages/auth/logout.vue index 703d9b4..01a1949 100644 --- a/pages/auth/logout.vue +++ b/pages/auth/logout.vue @@ -6,6 +6,9 @@ signOut({ callbackUrl: "/", }); + const d = inject>("dark"); + d.value = false; + document.body.dataset.theme = undefined;