merge marco eithan
This commit is contained in:
@@ -65,33 +65,63 @@ export default {
|
||||
nombre: localStorage.getItem("nombre"),
|
||||
programas: [],
|
||||
selected: {},
|
||||
token: {
|
||||
headers: {
|
||||
token: window.localStorage.getItem("token"),
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
obtenerProgramas() {
|
||||
return axios
|
||||
.get(
|
||||
`${process.env.api}/programa?idUsuario=${this.idResponsable}` //,this.token
|
||||
`${process.env.api}/programa?idUsuario=${this.idResponsable}`,
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.programas = res.data;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error();
|
||||
console.log(err.response);
|
||||
this.errorToken(err.response.data.message);
|
||||
console.log(err.response.data.message);
|
||||
});
|
||||
},
|
||||
error() {
|
||||
errorToken(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: "Ha ocurrido un <b>error</b>, inténtalo de nuevo más tarde",
|
||||
message: msj,
|
||||
type: "is-danger",
|
||||
hasIcon: true,
|
||||
icon: "times-circle",
|
||||
iconPack: "fa",
|
||||
icon: "alert-circle",
|
||||
iconPack: "mdi",
|
||||
ariaRole: "alertdialog",
|
||||
ariaModal: true,
|
||||
});
|
||||
if (salir == true) {
|
||||
localStorage.clear();
|
||||
this.$router.push(`/`);
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<b-loading
|
||||
:is-full-page="true"
|
||||
v-model="isLoading"
|
||||
:can-cancel="true"
|
||||
:can-cancel="false"
|
||||
></b-loading>
|
||||
</div>
|
||||
</template>
|
||||
@@ -32,7 +32,7 @@
|
||||
<script>
|
||||
import validator from "validator";
|
||||
import botonRegresar from "../../../../../components/botonRegresar";
|
||||
//import axios from 'axios'
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -50,7 +50,11 @@ export default {
|
||||
correo: "",
|
||||
},
|
||||
idServicio: localStorage.getItem("idServicio"),
|
||||
token: localStorage.getItem("token"),
|
||||
token: {
|
||||
headers: {
|
||||
token: window.localStorage.getItem("token"),
|
||||
},
|
||||
},
|
||||
isLoading: false,
|
||||
};
|
||||
},
|
||||
@@ -67,6 +71,70 @@ export default {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
actualizar() {
|
||||
this.isLoading = true;
|
||||
const data = {};
|
||||
if (this.nuevo.correo) {
|
||||
data.correoUpdate = this.nuevo.correo;
|
||||
}
|
||||
if (this.nuevo.nombre) {
|
||||
data.nombreUpdate = this.nuevo.nombre;
|
||||
}
|
||||
axios
|
||||
.put(`${process.env.api}/usuario/responsable/update`, data, this.token)
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
this.toast();
|
||||
this.$router.push("/admin/programa/infoResponsable");
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false;
|
||||
this.error(err.response.data.message);
|
||||
console.log(err.response.data.message);
|
||||
});
|
||||
},
|
||||
toast() {
|
||||
this.$buefy.toast.open({
|
||||
message: "Se han actualizado los datos del responsable",
|
||||
type: "is-success",
|
||||
});
|
||||
},
|
||||
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(`/`);
|
||||
}
|
||||
},
|
||||
},
|
||||
beforeCreate() {
|
||||
if (!localStorage.getItem("idResponsable")) {
|
||||
|
||||
Reference in New Issue
Block a user