@dongkboy 5 месяцев назад
Родитель
Сommit
5076da5f40
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/store/modules/user.ts

+ 1 - 1
src/store/modules/user.ts

@@ -22,7 +22,7 @@ const useUserStore = defineStore(
     const token = ref(localStorage.token ?? '')
     const avatar = ref(localStorage.avatar ?? '')
     const userInfo = ref(localStorage.userInfo ?? '')
-    const realName = JSON.parse(userInfo.value)?.name ?? '';
+    const realName = userInfo.value ? JSON.parse(userInfo.value)?.name ?? '' : '';
     const permissions = ref<string[]>([])
     const staticRouter = ref<string[]>([])
     const isLogin = computed(() => {