feat: fake-data can be edited, switching to end-points branch
This commit is contained in:
parent
6de38a9725
commit
9ba8e3e84e
@ -5,7 +5,9 @@
|
|||||||
<!-- Mode affichage -->
|
<!-- Mode affichage -->
|
||||||
<template v-if="!isEditing">
|
<template v-if="!isEditing">
|
||||||
<p>{{ currentDescription }}</p>
|
<p>{{ currentDescription }}</p>
|
||||||
<button v-if="expanded" @click.stop="startEditing" class="edit-button">Éditer</button>
|
<div class="button-container">
|
||||||
|
<button v-if="expanded" @click.stop="startEditing" class="edit-button">Éditer</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Mode édition -->
|
<!-- Mode édition -->
|
||||||
@ -64,9 +66,20 @@ const startEditing = () => {
|
|||||||
isEditing.value = true;
|
isEditing.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveEdit = () => {
|
const saveEdit = async () => {
|
||||||
currentDescription.value = editedDescription.value;
|
try {
|
||||||
isEditing.value = false;
|
const id = 1; // Mets l'ID ici (dans ton cas, l'unique entrée)
|
||||||
|
|
||||||
|
await axios.put(`http://localhost:5000/data/${id}`, {
|
||||||
|
canva_data: editedDescription.value
|
||||||
|
});
|
||||||
|
|
||||||
|
// Mettre à jour l'affichage local après la mise à jour réussie
|
||||||
|
currentDescription.value = editedDescription.value;
|
||||||
|
isEditing.value = false;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Erreur lors de la mise à jour des données :", error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const cancelEdit = () => {
|
const cancelEdit = () => {
|
||||||
@ -135,8 +148,8 @@ const cancelEdit = () => {
|
|||||||
|
|
||||||
.button-container {
|
.button-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 20px;
|
bottom: 40px;
|
||||||
right: 20px;
|
right: 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user