Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b3e3e059
authored
Aug 30, 2024
by
Vben
Committed by
GitHub
Aug 30, 2024
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perf: axios default error interceptor allows you to customize error handling (#4283)
1 parent
cc678a2b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
9 deletions
packages/@core/preferences/src/config.ts
packages/@core/ui-kit/layout-ui/src/vben-layout.vue
packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue
packages/effects/layouts/src/widgets/check-updates/check-updates.vue
packages/effects/request/src/request-client/preset-interceptors.ts
packages/effects/request/src/request-client/types.ts
packages/@core/preferences/src/config.ts
View file @
b3e3e05
...
@@ -75,7 +75,7 @@ const defaultPreferences: Preferences = {
...
@@ -75,7 +75,7 @@ const defaultPreferences: Preferences = {
tabbar
:
{
tabbar
:
{
dragable
:
true
,
dragable
:
true
,
enable
:
true
,
enable
:
true
,
height
:
3
6
,
height
:
3
8
,
keepAlive
:
true
,
keepAlive
:
true
,
persist
:
true
,
persist
:
true
,
showIcon
:
true
,
showIcon
:
true
,
...
...
packages/@core/ui-kit/layout-ui/src/vben-layout.vue
View file @
b3e3e05
...
@@ -50,7 +50,7 @@ const props = withDefaults(defineProps<Props>(), {
...
@@ -50,7 +50,7 @@ const props = withDefaults(defineProps<Props>(), {
sidebarWidth
:
180
,
sidebarWidth
:
180
,
sideCollapseWidth
:
60
,
sideCollapseWidth
:
60
,
tabbarEnable
:
true
,
tabbarEnable
:
true
,
tabbarHeight
:
36
,
tabbarHeight
:
40
,
zIndex
:
200
,
zIndex
:
200
,
});
});
...
...
packages/@core/ui-kit/tabs-ui/src/components/tabs-chrome/tabs.vue
View file @
b3e3e05
...
@@ -91,7 +91,7 @@ const tabsView = computed((): TabConfig[] => {
...
@@ -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"
class=
"tabs-chrome__background absolute z-[-1] size-full px-[calc(var(--gap)-1px)] py-0 transition-opacity duration-150"
>
>
<div
<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>
></div>
<svg
<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"
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"
...
@@ -128,7 +128,7 @@ const tabsView = computed((): TabConfig[] => {
...
@@ -128,7 +128,7 @@ const tabsView = computed((): TabConfig[] => {
<!-- tab-item-main -->
<!-- tab-item-main -->
<div
<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
<VbenIcon
v-if=
"showIcon"
v-if=
"showIcon"
...
@@ -168,7 +168,7 @@ const tabsView = computed((): TabConfig[] => {
...
@@ -168,7 +168,7 @@ const tabsView = computed((): TabConfig[] => {
@apply
pb-[2px];
@apply
pb-[2px];
&-content
{
&-content
{
@apply
bg-accent
-hover
mx-[2px]
rounded-md;
@apply
bg-accent
mx-[2px]
rounded-md;
}
}
}
}
}
}
...
...
packages/effects/layouts/src/widgets/check-updates/check-updates.vue
View file @
b3e3e05
...
@@ -76,7 +76,8 @@ function handleNotice(versionTag: string) {
...
@@ -76,7 +76,8 @@ function handleNotice(versionTag: string) {
ToastAction
,
ToastAction
,
{
{
altText
:
$t
(
'common.refresh'
),
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
:
()
=>
{
onClick
:
()
=>
{
lastVersionTag
.
value
=
versionTag
;
lastVersionTag
.
value
=
versionTag
;
window
.
location
.
reload
();
window
.
location
.
reload
();
...
...
packages/effects/request/src/request-client/preset-interceptors.ts
View file @
b3e3e05
...
@@ -87,7 +87,7 @@ export const errorMessageResponseInterceptor = (
...
@@ -87,7 +87,7 @@ export const errorMessageResponseInterceptor = (
errMsg
=
$t
(
'fallback.http.requestTimeout'
);
errMsg
=
$t
(
'fallback.http.requestTimeout'
);
}
}
if
(
errMsg
)
{
if
(
errMsg
)
{
makeErrorMessage
?.(
errMsg
);
makeErrorMessage
?.(
errMsg
,
error
);
return
Promise
.
reject
(
error
);
return
Promise
.
reject
(
error
);
}
}
...
@@ -119,7 +119,7 @@ export const errorMessageResponseInterceptor = (
...
@@ -119,7 +119,7 @@ export const errorMessageResponseInterceptor = (
errorMessage
=
$t
(
'fallback.http.internalServerError'
);
errorMessage
=
$t
(
'fallback.http.internalServerError'
);
}
}
}
}
makeErrorMessage
?.(
errorMessage
);
makeErrorMessage
?.(
errorMessage
,
error
);
return
Promise
.
reject
(
error
);
return
Promise
.
reject
(
error
);
},
},
};
};
...
...
packages/effects/request/src/request-client/types.ts
View file @
b3e3e05
...
@@ -28,7 +28,7 @@ interface ResponseInterceptorConfig<T = any> {
...
@@ -28,7 +28,7 @@ interface ResponseInterceptorConfig<T = any> {
rejected
?:
(
error
:
any
)
=>
any
;
rejected
?:
(
error
:
any
)
=>
any
;
}
}
type
MakeErrorMessageFn
=
(
message
:
string
)
=>
void
;
type
MakeErrorMessageFn
=
(
message
:
string
,
error
:
any
)
=>
void
;
interface
HttpResponse
<
T
=
any
>
{
interface
HttpResponse
<
T
=
any
>
{
/**
/**
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment