feat: 为通知路由添加认证要求,确保用户登录后才能访问

This commit is contained in:
2026-01-08 01:04:30 +07:00
parent 9ee8ffb806
commit ddb025b124
2 changed files with 3 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ const routes: Array<RouteRecordRaw> = [
{ {
path: "notify", path: "notify",
component: () => import("@/views/notify/index.vue"), component: () => import("@/views/notify/index.vue"),
meta: { requiresAuth: true },
}, },
{ {
path: "user", path: "user",

View File

@@ -14,8 +14,10 @@ export const useUserStore = defineStore("user", () => {
const isAuthenticated = computed(() => !!token.value); const isAuthenticated = computed(() => !!token.value);
async function updateProfile() { async function updateProfile() {
const { initializeWallet } = useWalletStore();
const { data } = await safeClient(client.api.user.profile.get(), { silent: true }); const { data } = await safeClient(client.api.user.profile.get(), { silent: true });
state.userProfile = data.value || null; state.userProfile = data.value || null;
initializeWallet();
} }
function setToken(value: string) { function setToken(value: string) {