21 lines
513 B
JavaScript
21 lines
513 B
JavaScript
const API_URL = "https://testowe.zikor.pl/api/v1/notices/";
|
|
|
|
export async function listNotices() {
|
|
const response = await fetch(`${API_URL}get/all`);
|
|
const data = await response.json();
|
|
if (!response.ok) {
|
|
throw new Error("Error");
|
|
}
|
|
return data;
|
|
}
|
|
|
|
export async function getNoticeById(noticeId) {
|
|
const response = await fetch(`${API_URL}get/${noticeId}`);
|
|
|
|
const data = await response.json();
|
|
if (!response.ok) {
|
|
throw new Error("Error");
|
|
}
|
|
return data;
|
|
}
|