From f2548d9b5267eb558d3dfc03b59bbb569818b63b Mon Sep 17 00:00:00 2001 From: vben Date: Fri, 30 Aug 2024 22:00:52 +0800 Subject: [PATCH] perf: axios default error interceptor allows you to customize error handling --- packages/@core/preferences/src/config.ts | 2 +- packages/@core/ui-kit/layout-ui/src/vben-layout.vue | 2 +- .../ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue | 6 +++--- .../layouts/src/widgets/check-updates/check-updates.vue | 3 ++- .../request/src/request-client/preset-interceptors.ts | 4 ++-- packages/effects/request/src/request-client/types.ts | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/@core/preferences/src/config.ts b/packages/@core/preferences/src/config.ts index c196b1536c2..e6fa3c17ead 100644 --- a/packages/@core/preferences/src/config.ts +++ b/packages/@core/preferences/src/config.ts @@ -75,7 +75,7 @@ const defaultPreferences: Preferences = { tabbar: { dragable: true, enable: true, - height: 36, + height: 38, keepAlive: true, persist: true, showIcon: true, diff --git a/packages/@core/ui-kit/layout-ui/src/vben-layout.vue b/packages/@core/ui-kit/layout-ui/src/vben-layout.vue index 7fd4dd77ed8..6418f170ead 100644 --- a/packages/@core/ui-kit/layout-ui/src/vben-layout.vue +++ b/packages/@core/ui-kit/layout-ui/src/vben-layout.vue @@ -50,7 +50,7 @@ const props = withDefaults(defineProps(), { sidebarWidth: 180, sideCollapseWidth: 60, tabbarEnable: true, - tabbarHeight: 36, + tabbarHeight: 40, zIndex: 200, }); diff --git a/packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue b/packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue index 80da99bfe37..2572b28760a 100644 --- a/packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue +++ b/packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue @@ -91,7 +91,7 @@ const tabsView = computed((): TabConfig[] => { class="tabs-chrome__background absolute z-[-1] size-full px-[calc(var(--gap)-1px)] py-0 transition-opacity duration-150" >
{
{ @apply pb-[2px]; &-content { - @apply bg-accent-hover mx-[2px] rounded-md; + @apply bg-accent mx-[2px] rounded-md; } } } diff --git a/packages/effects/layouts/src/widgets/check-updates/check-updates.vue b/packages/effects/layouts/src/widgets/check-updates/check-updates.vue index 4bd35cf4e07..4845f4a6a2c 100644 --- a/packages/effects/layouts/src/widgets/check-updates/check-updates.vue +++ b/packages/effects/layouts/src/widgets/check-updates/check-updates.vue @@ -76,7 +76,8 @@ function handleNotice(versionTag: string) { ToastAction, { altText: $t('common.refresh'), - class: 'bg-primary hover:bg-primary-hover mx-1', + class: + 'bg-primary text-primary-foreground hover:bg-primary-hover mx-1', onClick: () => { lastVersionTag.value = versionTag; window.location.reload(); diff --git a/packages/effects/request/src/request-client/preset-interceptors.ts b/packages/effects/request/src/request-client/preset-interceptors.ts index 49684cc1cc8..a03fec4b53b 100644 --- a/packages/effects/request/src/request-client/preset-interceptors.ts +++ b/packages/effects/request/src/request-client/preset-interceptors.ts @@ -87,7 +87,7 @@ export const errorMessageResponseInterceptor = ( errMsg = $t('fallback.http.requestTimeout'); } if (errMsg) { - makeErrorMessage?.(errMsg); + makeErrorMessage?.(errMsg, error); return Promise.reject(error); } @@ -119,7 +119,7 @@ export const errorMessageResponseInterceptor = ( errorMessage = $t('fallback.http.internalServerError'); } } - makeErrorMessage?.(errorMessage); + makeErrorMessage?.(errorMessage, error); return Promise.reject(error); }, }; diff --git a/packages/effects/request/src/request-client/types.ts b/packages/effects/request/src/request-client/types.ts index fa17ef3ddec..44f64761814 100644 --- a/packages/effects/request/src/request-client/types.ts +++ b/packages/effects/request/src/request-client/types.ts @@ -28,7 +28,7 @@ interface ResponseInterceptorConfig { rejected?: (error: any) => any; } -type MakeErrorMessageFn = (message: string) => void; +type MakeErrorMessageFn = (message: string, error: any) => void; interface HttpResponse { /**