0
0
Fork 0

refs #6172 feat:enable translation when ticketIsLocked

This commit is contained in:
Javier Segarra 2023-12-15 09:57:03 +01:00
parent a149928015
commit e525f87ccd
3 changed files with 19 additions and 7 deletions

View File

@ -39,12 +39,9 @@ const onResponse = (response) => {
const onResponseError = (error) => { const onResponseError = (error) => {
let message = ''; let message = '';
const response = error.response; const { response } = error;
const responseData = response && response.data; const dataError = response?.data?.error;
const responseError = responseData && response.data.error; const code = dataError?.code;
if (responseError) {
message = responseError.message;
}
switch (response?.status) { switch (response?.status) {
case 500: case 500:
@ -56,7 +53,12 @@ const onResponseError = (error) => {
case 504: case 504:
message = 'errors.statusGatewayTimeout'; message = 'errors.statusGatewayTimeout';
break; break;
default:
message = `errors.${dataError?.message}`;
break;
} }
if (code) message = code;
if (session.isLoggedIn() && response?.status === 401) { if (session.isLoggedIn() && response?.status === 401) {
session.destroy(); session.destroy();

View File

@ -71,7 +71,9 @@ export default {
statusGatewayTimeout: 'Could not contact the server', statusGatewayTimeout: 'Could not contact the server',
userConfig: 'Error fetching user config', userConfig: 'Error fetching user config',
create: 'Error during creation', create: 'Error during creation',
'This ticket is locked': 'dEste ticket está bloqueado',
}, },
'This ticket is locked': 'dEste ticket está bloqueado',
login: { login: {
title: 'Login', title: 'Login',
username: 'Username', username: 'Username',
@ -232,7 +234,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',
@ -243,6 +245,9 @@ export default {
selectVideo: 'Select video:', selectVideo: 'Select video:',
notFound: 'No videos available', notFound: 'No videos available',
}, },
error:{
locked: 'This item is locked'
},
summary: { summary: {
state: 'State', state: 'State',
salesPerson: 'Sales person', salesPerson: 'Sales person',

View File

@ -70,7 +70,9 @@ export default {
statusGatewayTimeout: 'No se ha podido contactar con el servidor', statusGatewayTimeout: 'No se ha podido contactar con el servidor',
userConfig: 'Error al obtener configuración de usuario', userConfig: 'Error al obtener configuración de usuario',
create: 'Error al crear', create: 'Error al crear',
'This ticket is locked': 'Este ticket está bloqueado',
}, },
'This ticket is locked': 'Este ticket está bloqueado',
login: { login: {
title: 'Inicio de sesión', title: 'Inicio de sesión',
username: 'Nombre de usuario', username: 'Nombre de usuario',
@ -241,6 +243,9 @@ export default {
selectVideo: 'Seleccionar vídeo:', selectVideo: 'Seleccionar vídeo:',
notFound: 'No hay vídeos disponibles', notFound: 'No hay vídeos disponibles',
}, },
error:{
locked: 'Este item está bloqueado'
},
summary: { summary: {
state: 'Estado', state: 'Estado',
salesPerson: 'Comercial', salesPerson: 'Comercial',