Compare commits
14 Commits
dev
...
6172_trans
Author | SHA1 | Date |
---|---|---|
Javi Gallego | 02272143d3 | |
Javier Segarra | 387d7a33e6 | |
Javier Segarra | da00a3f05f | |
Javier Segarra | 44e9c5f3d9 | |
Javier Segarra | 8631b642eb | |
Javier Segarra | 31d000b65f | |
Javier Segarra | 1b0cfa0d86 | |
Javier Segarra | 1c9493839d | |
Javier Segarra | 897d410ee6 | |
Javier Segarra | ca314c65d8 | |
Javier Segarra | 134cf011e3 | |
Javier Segarra | c4416545f8 | |
Javier Segarra | 8cfd775d58 | |
Javier Segarra | e525f87ccd |
|
@ -37,14 +37,11 @@ const onResponse = (response) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onResponseError = (error) => {
|
const onResponseError = (error) => {
|
||||||
let message = '';
|
if (!session.isLoggedIn()) {
|
||||||
|
return Promise.reject(error);
|
||||||
const response = error.response;
|
|
||||||
const responseData = response && response.data;
|
|
||||||
const responseError = responseData && response.data.error;
|
|
||||||
if (responseError) {
|
|
||||||
message = responseError.message;
|
|
||||||
}
|
}
|
||||||
|
const { response } = error;
|
||||||
|
let message = response?.data?.error?.message;
|
||||||
|
|
||||||
switch (response?.status) {
|
switch (response?.status) {
|
||||||
case 500:
|
case 500:
|
||||||
|
@ -56,15 +53,14 @@ const onResponseError = (error) => {
|
||||||
case 504:
|
case 504:
|
||||||
message = 'errors.statusGatewayTimeout';
|
message = 'errors.statusGatewayTimeout';
|
||||||
break;
|
break;
|
||||||
}
|
case 401:
|
||||||
|
if (session.isLoggedIn()) {
|
||||||
if (session.isLoggedIn() && response?.status === 401) {
|
session.destroy();
|
||||||
session.destroy();
|
const hash = window.location.hash;
|
||||||
const hash = window.location.hash;
|
const url = hash.slice(1);
|
||||||
const url = hash.slice(1);
|
Router.push({ path: url });
|
||||||
Router.push({ path: url });
|
}
|
||||||
} else if (!session.isLoggedIn()) {
|
break;
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Notify.create({
|
Notify.create({
|
||||||
|
|
|
@ -233,7 +233,7 @@ export default {
|
||||||
agency: 'Agency',
|
agency: 'Agency',
|
||||||
shipped: 'Shipped',
|
shipped: 'Shipped',
|
||||||
warehouse: 'Warehouse',
|
warehouse: 'Warehouse',
|
||||||
customerCard: 'Customer card',
|
customerCard: 'Customer card'
|
||||||
},
|
},
|
||||||
boxing: {
|
boxing: {
|
||||||
expedition: 'Expedition',
|
expedition: 'Expedition',
|
||||||
|
|
Loading…
Reference in New Issue