delete agenda

This commit is contained in:
ArenMg 2021-05-05 12:40:40 +03:00
parent 55f1f53a20
commit cd17fd7f78
2 changed files with 31 additions and 23 deletions

View file

@ -35,7 +35,7 @@
v-if="!isEditMode"
@click="
() => {
deleteAgenda();
deleteCurrentAgenda();
}
"
>
@ -93,7 +93,14 @@
</div>
<div class="space-top"></div>
<div v-if="isEditMode" class="space-top">
<button id="modifySondage" @click="()=>{modifyAgenda()}">
<button
id="modifySondage"
@click="
() => {
modifyAgenda();
}
"
>
Modifier l' agenda
</button>
</div>
@ -226,12 +233,27 @@ module.exports = {
body: "Modification de l'agenda",
});
},
deleteAgenda: async function () {
deleteCurrentAgenda: function () {
try {
swal({
title: "Êtes-vous sûr?",
text:
"L'agenda sera supprimé",
icon: "warning",
buttons: ["Annuler", true],
dangerMode: true,
}).then( async (willDelete) => {
if (willDelete) {
let _ = await axios.delete(`${baseUrl}/ws/agenda/calendars/${this.$route.query.id}`);
swal("Succès!", "L'agenda a été supprimé", "success").then((value) => {
location.href = baseUrl;
});
}
});
} catch (error) {
console.log(error)
swal("Erreur!", `${error}`, "error");
console.log(error);
}
},
},

View file

@ -47,19 +47,6 @@
</button>
</div>
</div>
<div v-if="isInserted" class="success-mess">
<p class="mess-text">Programme ajouté avec succès</p>
<button
class="exit-btn"
@click="
() => {
isInserted = false;
}
"
>
fermer
</button>
</div>
<div v-if="isNotInserted" class="error-mess">
<p class="mess-text">
Une érreur est survenue (veuillez remplir tous les champs
@ -191,11 +178,10 @@ module.exports = {
this.url = "";
this.selectedDate = new Date();
this.isNotInserted = false;
this.isInserted = true;
swal("Succès!", "L'agenda a été créé", "success");
} catch (error) {
this.isNotInserted = true;
this.isInserted = false;
swal("Erreur!", `${error}`, "error");
console.error(error);
}
},