mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 01:04:25 +08:00
show more user-friendly messages when some features are disabled
This commit is contained in:
@@ -212,6 +212,8 @@ import { useUserExternalAuthStore } from '@/stores/userExternalAuth.ts';
|
||||
import { useTokensStore } from '@/stores/token.ts';
|
||||
|
||||
import { itemAndIndex, reversedItemAndIndex } from '@/core/base.ts';
|
||||
import { KnownErrorCode } from '@/consts/api.ts';
|
||||
|
||||
import { type UserExternalAuthInfoResponse } from '@/models/user_external_auth.ts';
|
||||
import { type TokenInfoResponse, SessionDeviceType, SessionInfo } from '@/models/token.ts';
|
||||
|
||||
@@ -440,7 +442,10 @@ function reloadExternalAuth(silent?: boolean): void {
|
||||
}).catch(error => {
|
||||
loadingExternalAuth.value = false;
|
||||
|
||||
if (!error.processed) {
|
||||
if (error.error && error.error.errorCode === KnownErrorCode.ApiNotFound) {
|
||||
externalAuths.value = [];
|
||||
} else if (!error.processed) {
|
||||
externalAuths.value = [];
|
||||
snackbar.value?.showError(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,6 +110,7 @@ import { useI18n } from '@/locales/helpers.ts';
|
||||
|
||||
import { useTwoFactorAuthStore } from '@/stores/twoFactorAuth.ts';
|
||||
|
||||
import { KnownErrorCode } from '@/consts/api.ts';
|
||||
import { copyTextToClipboard } from '@/lib/ui/common.ts';
|
||||
|
||||
import {
|
||||
@@ -145,7 +146,10 @@ function init(): void {
|
||||
}).catch(error => {
|
||||
loading.value = false;
|
||||
|
||||
if (!error.processed) {
|
||||
if (error.error && error.error.errorCode === KnownErrorCode.ApiNotFound) {
|
||||
status.value = null;
|
||||
} else if (!error.processed) {
|
||||
status.value = null;
|
||||
snackbar.value?.showError(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -63,6 +63,7 @@ import type { Router } from 'framework7/types';
|
||||
import { useI18n } from '@/locales/helpers.ts';
|
||||
import { useI18nUIComponents, showLoading, hideLoading } from '@/lib/ui/mobile.ts';
|
||||
|
||||
import { KnownErrorCode } from '@/consts/api.ts';
|
||||
import { useTwoFactorAuthStore } from '@/stores/twoFactorAuth.ts';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -100,6 +101,10 @@ function init(): void {
|
||||
loading.value = false;
|
||||
}).catch(error => {
|
||||
if (error.processed) {
|
||||
status.value = null;
|
||||
loading.value = false;
|
||||
} else if (error.error && error.error.errorCode === KnownErrorCode.ApiNotFound) {
|
||||
status.value = null;
|
||||
loading.value = false;
|
||||
} else {
|
||||
loadingError.value = error;
|
||||
|
||||
Reference in New Issue
Block a user