tokensErrores
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user