merge marco eithan

This commit is contained in:
Lemuel Marquez
2021-01-06 15:48:46 -06:00
8 changed files with 381 additions and 64 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,47 @@ 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";
salir = true;
break;
case "jwt expired":
msj = "tu sesión ha expirado, inicia sesión de nuevo";
salir = true;
break;
case "jwt malformed":
msj = "tu token esta mal formado, inicia sesión de nuevo";
salir = true;
break;
case "No hay token":
msj = "no has enviado tu token, inicia sesión de nuevo";
salir = true;
break;
}
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");
},