merge marco eithan
This commit is contained in:
@@ -36,10 +36,16 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
csv: {},
|
||||
token: {
|
||||
headers: {
|
||||
token: window.localStorage.getItem("token"),
|
||||
},
|
||||
},
|
||||
isLoading: false,
|
||||
toastType: null,
|
||||
toastMessage: null,
|
||||
@@ -79,7 +85,12 @@ export default {
|
||||
formData.append("cartaAceptacion", this.cartaAceptacion);
|
||||
}
|
||||
axios
|
||||
.put(`${process.env.api}/programa/carga_masiva`, formData)
|
||||
.put(`${process.env.api}/programa/carga_masiva`, formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
token: this.token.headers.token,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
this.toastType = "is-success";
|
||||
@@ -88,11 +99,46 @@ export default {
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false;
|
||||
this.toastType = "is-danger";
|
||||
this.toastMessage = err.response.data.message;
|
||||
this.toast();
|
||||
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(`/`);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -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");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user