@@ -55,7 +58,7 @@
{
const servicios = res.data.servicios;
@@ -337,11 +347,13 @@ export default {
}
currentTotal = this.perPage * contador;
this.total = currentTotal;
- this.loading = false;
})
- .catch((err) => {
- console.log(err.response.data.message);
- this.loading = false;
+ .catch((error) => {
+ error(error.response.data.message);
+ })
+
+ .finally(() => {
+ this.isLoading = false;
});
},
cartaAceptacion(idServicio, idStatus) {
@@ -350,8 +362,44 @@ export default {
this.$router.push("/responsable/carta_aceptacion");
},
getIdLocal() {
- this.idTipoUsuario = localStorage.getItem("idTipoUsuario");
this.idUsuario = localStorage.getItem("idUsuario");
+ this.idTipoUsuario = localStorage.getItem("idTipoUsuario");
+ this.tipoUsuario = localStorage.getItem("tipoUsuario");
+
+ if (this.idTipoUsuario != 2 && this.tipoUsuario != "responsable") {
+ this.$router.push("/");
+ }
+ },
+ 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(`/`);
+ }
},
},
created() {
diff --git a/pages/admin/index.vue b/pages/admin/index.vue
index 50d3e59..900af63 100644
--- a/pages/admin/index.vue
+++ b/pages/admin/index.vue
@@ -19,7 +19,7 @@