forked from verdnatura/salix-front
feat(): refs #8039 canceledError not notify
This commit is contained in:
parent
76b69a7588
commit
52981953f7
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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');
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue