feat(): refs #8039 canceledError not notify

This commit is contained in:
Alex Moreno 2024-10-21 13:23:45 +02:00
parent 76b69a7588
commit 52981953f7
2 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,7 @@ import { useSession } from 'src/composables/useSession';
import { Router } from 'src/router';
import useNotify from 'src/composables/useNotify.js';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
import { CanceledError } from 'axios';
const session = useSession();
const { notify } = useNotify();
@ -42,7 +43,7 @@ const onResponseError = (error) => {
let message = '';
const response = error.response;
const responseData = response && response.data;
const responseData = response?.data;
const responseError = responseData && response.data.error;
if (responseError) {
message = responseError.message;
@ -78,7 +79,7 @@ const onResponseError = (error) => {
return Promise.reject(error);
}
notify(message, 'negative');
if (!(error instanceof CanceledError)) notify(message, 'negative');
return Promise.reject(error);
};

View File

@ -3,6 +3,7 @@ import qFormMixin from './qformMixin';
import mainShortcutMixin from './mainShortcutMixin';
import keyShortcut from './keyShortcut';
import useNotify from 'src/composables/useNotify.js';
import { CanceledError } from 'axios';
const { notify } = useNotify();
export default boot(({ app }) => {
@ -11,6 +12,6 @@ export default boot(({ app }) => {
app.directive('shortcut', keyShortcut);
app.config.errorHandler = function (err) {
console.error(err);
notify('globals.error', 'negative', 'error');
if (!(err instanceof CanceledError)) notify('globals.error', 'negative', 'error');
};
});