#88 - edit comment fonctional but not styled

This commit is contained in:
isUnknown 2025-01-07 15:19:50 +01:00
parent ea2817244b
commit 6cc8325d2b
5 changed files with 102 additions and 23 deletions

View file

@ -143,6 +143,29 @@ export const useApiStore = defineStore("api", () => {
}
}
async function updateComment(comment) {
const headers = {
method: "POST",
body: JSON.stringify(comment),
};
try {
const response = await fetch("/update-comment.json", headers);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const newFile = await response.json();
return newFile;
} catch (error) {
console.error(
"Une erreur s'est produite lors de la mise à jour du commentaire :",
comment,
error
);
throw error;
}
}
async function deleteComment(comment) {
const headers = {
method: "POST",
@ -259,6 +282,7 @@ export const useApiStore = defineStore("api", () => {
fetchData,
fetchRoute,
addComment,
updateComment,
deleteComment,
replyComment,
readNotification,

View file

@ -6,6 +6,7 @@ export const useDialogStore = defineStore("dialog", () => {
const content = ref(null);
const openedFile = ref(null);
const activeTracks = ref(null);
const isEditCommentMode = ref(false);
const comments = computed(() => {
if (activeTracks.value?.length > 0) {
@ -143,5 +144,6 @@ export const useDialogStore = defineStore("dialog", () => {
isCommentsOpen,
isCommentPanelEnabled,
updateFile,
isEditCommentMode,
};
});