DTL : optimization appointment request working
This commit is contained in:
parent
11657a5589
commit
54af78e32c
8 changed files with 132 additions and 25 deletions
|
|
@ -75,24 +75,21 @@ export const useApiStore = defineStore("api", () => {
|
|||
}
|
||||
}
|
||||
|
||||
async function requestProjectCreation(data) {
|
||||
async function post(data, route) {
|
||||
const headers = {
|
||||
method: "POST",
|
||||
body: JSON.stringify(data),
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch("/request-project-creation.json", headers);
|
||||
const response = await fetch(route, headers);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"Une erreur s'est produite lors de l'ajout du commentaire :",
|
||||
error
|
||||
);
|
||||
console.error("Une erreur s'est produite :", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
@ -249,6 +246,6 @@ export const useApiStore = defineStore("api", () => {
|
|||
readNotification,
|
||||
readAllNotifications,
|
||||
validateBrief,
|
||||
requestProjectCreation,
|
||||
post,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue