chore: update documentation and deps (#4510)
* chore: update docs * chore: update deps * chore: update action * fix: reset after preferences are refreshed * fix: ci error
This commit is contained in:
@@ -163,6 +163,8 @@ The `src/api/request.ts` within the application can be configured according to t
|
||||
/**
|
||||
* This file can be adjusted according to business logic
|
||||
*/
|
||||
import type { HttpResponse } from '@vben/request';
|
||||
|
||||
import { useAppConfig } from '@vben/hooks';
|
||||
import { preferences } from '@vben/preferences';
|
||||
import {
|
||||
@@ -227,7 +229,7 @@ function createRequestClient(baseURL: string) {
|
||||
});
|
||||
|
||||
// Deal Response Data
|
||||
client.addResponseInterceptor({
|
||||
client.addResponseInterceptor<HttpResponse>({
|
||||
fulfilled: (response) => {
|
||||
const { data: responseData, status } = response;
|
||||
|
||||
@@ -253,7 +255,10 @@ function createRequestClient(baseURL: string) {
|
||||
|
||||
// Generic error handling; if none of the above error handling logic is triggered, it will fall back to this.
|
||||
client.addResponseInterceptor(
|
||||
errorMessageResponseInterceptor((msg: string) => message.error(msg)),
|
||||
errorMessageResponseInterceptor((msg: string, _error) => {
|
||||
// 这里可以根据业务进行定制,你可以拿到 error 内的信息进行定制化处理,根据不同的 code 做不同的提示,而不是直接使用 message.error 提示 msg
|
||||
message.error(msg);
|
||||
}),
|
||||
);
|
||||
|
||||
return client;
|
||||
|
Reference in New Issue
Block a user