reply comment working

This commit is contained in:
isUnknown 2024-10-29 16:51:31 +01:00
parent 2af56989c9
commit 8ed7331b61
5 changed files with 101 additions and 14 deletions

View file

@ -144,6 +144,29 @@ export const useApiStore = defineStore("api", () => {
}
}
async function replyComment(comment) {
const headers = {
method: "POST",
body: JSON.stringify(comment),
};
try {
const response = await fetch("/reply-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 l'ajout de la réponse' :",
commentaire,
error
);
throw error;
}
}
async function readNotification(userUuid, group, notificationId) {
const headers = {
method: "POST",
@ -175,6 +198,7 @@ export const useApiStore = defineStore("api", () => {
fetchData,
fetchRoute,
addComment,
replyComment,
readNotification,
};
});