feat: 重构用户认证逻辑,添加导航重定向功能,更新相关组件和路由
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user