fix: cannot show message when userGetInfo failed

This commit is contained in:
yangsy
2025-08-27 10:11:49 +08:00
parent 9ec22b883b
commit f5c676ea0b

View File

@@ -11,6 +11,7 @@ import { useStationStore } from '@/stores/station';
import { useUserStore } from '@/stores/user'; import { useUserStore } from '@/stores/user';
import { AlertFilled, /* AreaChartOutlined, */ FileTextFilled, HomeFilled, LogoutOutlined, VideoCameraFilled } from '@vicons/antd'; import { AlertFilled, /* AreaChartOutlined, */ FileTextFilled, HomeFilled, LogoutOutlined, VideoCameraFilled } from '@vicons/antd';
import { ChevronDown } from '@vicons/carbon'; import { ChevronDown } from '@vicons/carbon';
import type { AxiosError } from 'axios';
import { NButton, NDropdown, NFlex, NIcon, NLayout, NLayoutContent, NLayoutFooter, NLayoutHeader, NLayoutSider, NMenu, NScrollbar, type DropdownOption, type MenuOption } from 'naive-ui'; import { NButton, NDropdown, NFlex, NIcon, NLayout, NLayoutContent, NLayoutFooter, NLayoutHeader, NLayoutSider, NMenu, NScrollbar, type DropdownOption, type MenuOption } from 'naive-ui';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { h, onBeforeMount, onBeforeUnmount, ref, type Component, type VNode } from 'vue'; import { h, onBeforeMount, onBeforeUnmount, ref, type Component, type VNode } from 'vue';
@@ -29,7 +30,7 @@ onBeforeUnmount(() => {
}); });
onBeforeMount(() => { onBeforeMount(() => {
userStore.userGetInfo().catch((err) => window.$message.error(err)); userStore.userGetInfo().catch((err) => window.$message.error((err as AxiosError).message));
}); });
const route = useRoute(); const route = useRoute();