diff --git a/app/web/src/api/meta.ts b/app/web/src/api/meta.ts index 050d2c1..2be15f4 100644 --- a/app/web/src/api/meta.ts +++ b/app/web/src/api/meta.ts @@ -17,11 +17,11 @@ class MetaAPI extends Meta { const e = error as RequestError if (e.status === 500 && error.message.includes('Failed to fetch')) { this.printMessage(i18nt('api.error.network')) - return } - if (e.response) { + else if (e.response) { this.handleError(e.response as OctokitResponse<{ message: string }>) } + throw error }) } diff --git a/app/web/src/main.ts b/app/web/src/main.ts index c8aa8b6..00a67fb 100644 --- a/app/web/src/main.ts +++ b/app/web/src/main.ts @@ -26,7 +26,7 @@ async function run() { app.use(i18n) const appStore = useAppStore() - await appStore.initLoad() + appStore.initLoad() app.use(router) app.mount('#app') diff --git a/app/web/src/store/app.ts b/app/web/src/store/app.ts index 091ef18..1db57b4 100644 --- a/app/web/src/store/app.ts +++ b/app/web/src/store/app.ts @@ -12,7 +12,7 @@ import issueApi from '~/api/module/issue' import type { Label } from '~/api/module/label' import labelApi from '~/api/module/label' import appConfig from '~/app.config' -import { lngList, useI18n } from '~/i18n' +import { i18nt, lngList } from '~/i18n' import { IBrightnessDown, IMoonF } from '~/icons' import { RouteName } from '~/router/routes' @@ -149,7 +149,6 @@ export const useAppStore = defineStore('app', { }, getters: { menuOptions(state): MenuOption[] { - const { t } = useI18n() return state.dMenus.filter((menu) => { return menu.label ? state.labels.some(label => label.name === menu.label) @@ -159,7 +158,7 @@ export const useAppStore = defineStore('app', { label: () => h( RouterLink, { to: { name: menu.routerName } }, - { default: () => t(menu.name) }, + { default: () => i18nt(menu.name) }, ), key: menu.routerName, } @@ -168,6 +167,9 @@ export const useAppStore = defineStore('app', { theme(state) { return state.themes[state.themeIndex] }, + loadLabelsFinished(state) { + return state.labels.length > 0 + }, }, persist: { key: `${appConfig.appName}-store-${appConfig.version}`, diff --git a/app/web/src/views/VNotFound.vue b/app/web/src/views/VNotFound.vue index 73c1553..2c7b7eb 100644 --- a/app/web/src/views/VNotFound.vue +++ b/app/web/src/views/VNotFound.vue @@ -8,7 +8,7 @@ const { t } = useI18n()