Reject when connection failed

This commit is contained in:
jeffvli
2022-11-20 17:01:18 -08:00
parent 079a400e74
commit b0f031bedc
+4 -4
View File
@@ -31,6 +31,10 @@ ax.interceptors.response.use(
return res; return res;
}, },
async (err) => { async (err) => {
if (!err.response) {
return Promise.reject(err);
}
if (err.response && err.response.status === 401) { if (err.response && err.response.status === 401) {
const { config } = err; const { config } = err;
@@ -55,10 +59,6 @@ ax.interceptors.response.use(
return Axios(config); return Axios(config);
} }
// if (err.response.data.error.message === 'No auth token') {
// auth.logout();
// }
auth.logout(); auth.logout();
} }
return Promise.reject(err); return Promise.reject(err);