tokensErrores

This commit is contained in:
Andres2908
2021-01-05 18:54:43 -06:00
parent 015664574b
commit 5b704de6ca
5 changed files with 181 additions and 79 deletions
+34 -9
View File
@@ -142,7 +142,7 @@ export default {
idUsuario: "",
data: [],
total: "",
loading: true,
isLoading: false,
page: 1,
perPage: 25,
numeroCuenta: "",
@@ -224,15 +224,13 @@ export default {
}
currentTotal = this.perPage * contador;
this.total = currentTotal;
this.loading = false;
})
.catch((err) => {
if (error.response.status == 401) {
localStorage.clear();
this.$router.push("/");
}
console.log(err.response.data.message);
this.loading = false;
.catch((error) => {
error(error.response.data.message);
})
.finally(() => {
this.isLoading = false;
});
},
servicios(idServicio) {
@@ -242,6 +240,33 @@ export default {
getIdLocal() {
this.idUsuario = localStorage.getItem("idUsuario");
},
error(msj) {
if (msj == "jwt expired") {
msj = "Su sesión expiro";
} else if (msj == "invalid signature") {
msj = "El token no es valido";
}
this.$buefy.dialog.alert({
title: "Error",
message: msj,
type: "is-danger",
hasIcon: true,
icon: "alert-circle",
iconPack: "mdi",
ariaRole: "alertdialog",
ariaModal: true,
});
if (
msj == "El token no es valido" ||
msj == "Su sesión expiro" ||
msj == "No hay token"
) {
localStorage.clear();
this.$router.push("/");
}
},
},
created() {
this.getIdLocal();