forked from verdnatura/hedera-web
perf: improve interceptor
This commit is contained in:
parent
e47edb9827
commit
f821b8689a
|
@ -21,7 +21,7 @@ const onRequestError = error => {
|
|||
};
|
||||
|
||||
const onResponseError = error => {
|
||||
let message = '';
|
||||
let message = error.message;
|
||||
|
||||
const response = error.response;
|
||||
const responseData = response && response.data;
|
||||
|
@ -35,12 +35,6 @@ const onResponseError = error => {
|
|||
return Promise.reject(error);
|
||||
};
|
||||
|
||||
const jApiErrorInterceptor = error => {
|
||||
if (error.message) {
|
||||
notify(error.message, 'negative');
|
||||
}
|
||||
};
|
||||
|
||||
export default boot(({ app }) => {
|
||||
const user = userStore();
|
||||
function addToken(config) {
|
||||
|
@ -53,7 +47,7 @@ export default boot(({ app }) => {
|
|||
api.interceptors.response.use(response => response, onResponseError);
|
||||
|
||||
jApi.use(addToken);
|
||||
jApi.useErrorInterceptor(jApiErrorInterceptor);
|
||||
jApi.useErrorInterceptor(onResponseError);
|
||||
|
||||
// for use inside Vue files (Options API) through this.$axios and this.$api
|
||||
|
||||
|
|
Loading…
Reference in New Issue