feat: 重构用户认证逻辑,添加导航重定向功能,更新相关组件和路由

This commit is contained in:
2025-12-21 02:37:01 +07:00
parent b957eb7cc2
commit 7fcb2555a3
18 changed files with 104 additions and 67 deletions

View File

@@ -6,6 +6,7 @@ import { authClient } from "@/auth";
const router = useRouter();
const userStore = useUserStore();
const { user, userProfile } = storeToRefs(userStore);
async function handleSignOut() {
const alert = await alertController.create({
@@ -20,6 +21,7 @@ async function handleSignOut() {
text: "Sign Out",
role: "destructive",
handler: async () => {
userStore.signOut();
authClient.signOut();
router.replace("/layout/riwa");
},
@@ -88,7 +90,7 @@ async function handleSignOut() {
</div>
</div>
<div class="end">
{{ userStore.state.userProfile?.nickname }}
{{ userProfile?.nickname }}
</div>
</div>
</ion-item>
@@ -101,7 +103,7 @@ async function handleSignOut() {
</div>
</div>
<div class="end">
{{ userStore.state.session?.email }}
{{ user?.email }}
</div>
</div>
</ion-item>