This commit is contained in:
2021-01-06 00:10:12 -06:00
parent d9563134b2
commit 34773defe0
7 changed files with 388 additions and 97 deletions
@@ -74,6 +74,11 @@ export default {
correo: "",
nombre: "",
idStatus: 1,
token: {
headers: {
token: window.localStorage.getItem("token"),
},
}
};
},
methods: {
@@ -87,7 +92,8 @@ export default {
this.data = [];
axios
.get(
`${process.env.api}/usuario/responsable?pagina=${this.page}&nombre=${this.nombre}&correo=${this.correo}`
`${process.env.api}/usuario/responsable?pagina=${this.page}&nombre=${this.nombre}&correo=${this.correo}`,
this.token
)
.then((res) => {
const servicios = res.data.servicios;
@@ -110,10 +116,42 @@ export default {
this.loading = false;
})
.catch((err) => {
console.log(err.response.data.message);
this.loading = false;
this.error(err.response.data.message);
console.log(err.response.data.message);
});
},
error(msj){
let salir =false;
switch(msj){
case 'invalid signature':
msj= "tu token no es valido, inicia sesión de nuevo"
break;
case 'jwt expired':
msj= "tu sesión ha expirado, inicia sesión de nuevo"
break;
case 'no hay token':
msj= "no has enviado tu token, inicia sesión de nuevo"
break;
default:
salir=true
}
this.$buefy.dialog.alert({
title: "Error",
message: msj,
type: "is-danger",
hasIcon: true,
icon: "alert-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
if (salir === true) {
localStorage.clear()
this.$router.push(`/`)
}
},
insertIdLocal() {
this.idUsuario = localStorage.getItem("idUsuario");
},