mirror of https://gitee.com/answerdev/answer.git
fix: notification status api ignore 50x error
This commit is contained in:
parent
f41a2ac761
commit
7b55f28993
|
@ -34,7 +34,7 @@ export const useQueryNotificationStatus = () => {
|
|||
|
||||
return useSWR<Type.NotificationStatus>(
|
||||
tryLoggedAndActivated().ok ? apiUrl : null,
|
||||
request.instance.get,
|
||||
(url) => request.get(url, { ignoreError: '50X' }),
|
||||
{
|
||||
refreshInterval: 3000,
|
||||
},
|
||||
|
|
|
@ -19,6 +19,7 @@ const baseConfig = {
|
|||
interface ApiConfig extends AxiosRequestConfig {
|
||||
// Configure whether to allow takeover of 404 errors
|
||||
allow404?: boolean;
|
||||
ignoreError?: '403' | '50X';
|
||||
// Configure whether to pass errors directly
|
||||
passingError?: boolean;
|
||||
}
|
||||
|
@ -169,7 +170,11 @@ class Request {
|
|||
if (isIgnoredPath(IGNORE_PATH_LIST)) {
|
||||
return Promise.reject(false);
|
||||
}
|
||||
|
||||
if (error.config?.ignoreError !== '50X') {
|
||||
errorCodeStore.getState().update('50X');
|
||||
}
|
||||
|
||||
console.error(
|
||||
`Request failed with status code ${status}, ${msg || ''}`,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue