edit agenda

This commit is contained in:
ArenMg 2021-05-05 14:28:48 +03:00
parent cd17fd7f78
commit 485feeae3a

View file

@ -228,29 +228,43 @@ module.exports = {
}, },
}); });
}, },
modifyAgenda: function () { modifyAgenda: async function () {
new BrowserNotification("En cours de construction ....", { try {
body: "Modification de l'agenda", let success = await axios({
method: "put",
url: `${baseUrl}/ws/agenda/calendars/${this.$route.query.id}`,
data: this.editionProgram,
}); });
console.log(success)
swal("Succès!", "L'agenda a été modifié", "success").then((value) => {
this.program = {...this.editionProgram}
this.isEditMode = false;
});
} catch (error) {
swal("Erreur", `Une erreur s'est produite`, "error");
console.log(error);
}
}, },
deleteCurrentAgenda: function () { deleteCurrentAgenda: function () {
try { try {
swal({ swal({
title: "Êtes-vous sûr?", title: "Êtes-vous sûr?",
text: text: "L'agenda sera supprimé",
"L'agenda sera supprimé",
icon: "warning", icon: "warning",
buttons: ["Annuler", true], buttons: ["Annuler", true],
dangerMode: true, dangerMode: true,
}).then(async (willDelete) => { }).then(async (willDelete) => {
if (willDelete) { if (willDelete) {
let _ = await axios.delete(`${baseUrl}/ws/agenda/calendars/${this.$route.query.id}`); let _ = await axios.delete(
swal("Succès!", "L'agenda a été supprimé", "success").then((value) => { `${baseUrl}/ws/agenda/calendars/${this.$route.query.id}`
);
swal("Succès!", "L'agenda a été supprimé", "success").then(
(value) => {
location.href = baseUrl; location.href = baseUrl;
}); }
);
} }
}); });
} catch (error) { } catch (error) {
swal("Erreur!", `${error}`, "error"); swal("Erreur!", `${error}`, "error");
console.log(error); console.log(error);