#88 - edit comment fonctional but not styled
This commit is contained in:
parent
ea2817244b
commit
6cc8325d2b
5 changed files with 102 additions and 23 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue