Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: axios default error interceptor allows you to customize error handling #4283

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@core/preferences/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const defaultPreferences: Preferences = {
tabbar: {
dragable: true,
enable: true,
height: 36,
height: 38,
keepAlive: true,
persist: true,
showIcon: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/@core/ui-kit/layout-ui/src/vben-layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const props = withDefaults(defineProps<Props>(), {
sidebarWidth: 180,
sideCollapseWidth: 60,
tabbarEnable: true,
tabbarHeight: 36,
tabbarHeight: 40,
zIndex: 200,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
<div
class="tabs-chrome__background-content group-[.is-active]:bg-heavy dark:group-[.is-active]:bg-accent h-full rounded-tl-[var(--gap)] rounded-tr-[var(--gap)] duration-150"
class="tabs-chrome__background-content group-[.is-active]:bg-primary/15 dark:group-[.is-active]:bg-accent h-full rounded-tl-[var(--gap)] rounded-tr-[var(--gap)] duration-150"
></div>
<svg
class="tabs-chrome__background-before group-[.is-active]:fill-primary/15 dark:group-[.is-active]:fill-accent absolute bottom-0 left-[-1px] fill-transparent transition-all duration-150"
Expand Down Expand Up @@ -128,7 +128,7 @@ const tabsView = computed((): TabConfig[] => {

<!-- tab-item-main -->
<div
class="tabs-chrome__item-main group-[.is-active]:text-accent-foreground dark:group-[.is-active]:text-accent-foreground text-accent-foreground z-[2] mx-[calc(var(--gap)*2)] my-0 flex h-full items-center overflow-hidden rounded-tl-[5px] rounded-tr-[5px] pl-2 pr-4 duration-150"
class="tabs-chrome__item-main group-[.is-active]:text-primary dark:group-[.is-active]:text-accent-foreground text-accent-foreground z-[2] mx-[calc(var(--gap)*2)] my-0 flex h-full items-center overflow-hidden rounded-tl-[5px] rounded-tr-[5px] pl-2 pr-4 duration-150"
>
<VbenIcon
v-if="showIcon"
Expand Down Expand Up @@ -168,7 +168,7 @@ const tabsView = computed((): TabConfig[] => {
@apply pb-[2px];

&-content {
@apply bg-accent-hover mx-[2px] rounded-md;
@apply bg-accent mx-[2px] rounded-md;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const errorMessageResponseInterceptor = (
errMsg = $t('fallback.http.requestTimeout');
}
if (errMsg) {
makeErrorMessage?.(errMsg);
makeErrorMessage?.(errMsg, error);
return Promise.reject(error);
}

Expand Down Expand Up @@ -119,7 +119,7 @@ export const errorMessageResponseInterceptor = (
errorMessage = $t('fallback.http.internalServerError');
}
}
makeErrorMessage?.(errorMessage);
makeErrorMessage?.(errorMessage, error);
return Promise.reject(error);
},
};
Expand Down
2 changes: 1 addition & 1 deletion packages/effects/request/src/request-client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface ResponseInterceptorConfig<T = any> {
rejected?: (error: any) => any;
}

type MakeErrorMessageFn = (message: string) => void;
type MakeErrorMessageFn = (message: string, error: any) => void;

interface HttpResponse<T = any> {
/**
Expand Down
Loading