mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: Extract the code for building categorize operator coordinates to hooks.ts #1739 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -9,7 +9,7 @@ import { history } from 'umi';
|
||||
import { RequestMethod, extend } from 'umi-request';
|
||||
import { convertTheKeysOfTheObjectToSnake } from './common-util';
|
||||
|
||||
const ABORT_REQUEST_ERR_MESSAGE = 'The user aborted a request.';
|
||||
const FAILED_TO_FETCH = 'Failed to fetch';
|
||||
|
||||
const RetcodeMessage = {
|
||||
200: i18n.t('message.200'),
|
||||
@ -50,8 +50,11 @@ const errorHandler = (error: {
|
||||
message: string;
|
||||
}): Response => {
|
||||
const { response } = error;
|
||||
if (error.message === ABORT_REQUEST_ERR_MESSAGE) {
|
||||
console.log('user abort request');
|
||||
if (error.message === FAILED_TO_FETCH) {
|
||||
notification.error({
|
||||
description: i18n.t('message.networkAnomalyDescription'),
|
||||
message: i18n.t('message.networkAnomaly'),
|
||||
});
|
||||
} else {
|
||||
if (response && response.status) {
|
||||
const errorText =
|
||||
@ -61,11 +64,6 @@ const errorHandler = (error: {
|
||||
message: `${i18n.t('message.requestError')} ${status}: ${url}`,
|
||||
description: errorText,
|
||||
});
|
||||
} else if (!response) {
|
||||
notification.error({
|
||||
description: i18n.t('message.networkAnomalyDescription'),
|
||||
message: i18n.t('message.networkAnomaly'),
|
||||
});
|
||||
}
|
||||
}
|
||||
return response;
|
||||
@ -102,6 +100,7 @@ request.interceptors.response.use(async (response: any, options) => {
|
||||
if (options.responseType === 'blob') {
|
||||
return response;
|
||||
}
|
||||
|
||||
const data: ResponseType = await response.clone().json();
|
||||
|
||||
if (data.retcode === 401 || data.retcode === 401) {
|
||||
|
||||
Reference in New Issue
Block a user