From 53be0b2f50f211325a584b300ec0dfd4f904697b Mon Sep 17 00:00:00 2001 From: Patryk Date: Tue, 29 Apr 2025 19:42:06 +0200 Subject: [PATCH] init simple create --- ArtisanConnect/api/notices.jsx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ArtisanConnect/api/notices.jsx b/ArtisanConnect/api/notices.jsx index 22f8893..3176b48 100644 --- a/ArtisanConnect/api/notices.jsx +++ b/ArtisanConnect/api/notices.jsx @@ -20,16 +20,16 @@ export async function getNoticeById(noticeId) { } export async function createNotice(notice) { - console.log("Notice created", notice); - // const response = await fetch(`${API_URL}add`, { - // method: "POST", - // headers: { - // "Content-Type": "application/json", - // }, - // body: JSON.stringify(notice), - // }); - // console.log("Response", response); - // if (!response.ok) { - // throw new Error("Error"); - // } + // console.log("Notice created", notice); + const response = await fetch(`${API_URL}add`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(notice), + }); + console.log("Response", response); + if (!response.ok) { + throw new Error("Error"); + } }