const BASE_URL = "https://kirkleon.ddns.net/vacation-planner/api" export const getHealth = async () => { const res = await fetch(BASE_URL + "/"); if (!res.ok) { throw new Error(res.statusText); } const { status } = await res.json(); return status; } export const getAvailability = async () => { const res = await fetch(BASE_URL + "/availability"); if (!res.ok) { throw new Error(res.statusText); } return await res.json(); } export const setAvailability = async (name, availability) => { const res = await fetch( BASE_URL + "/availability", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ name, availability }), } ); if (!res.ok) { throw new Error(res.statusText); } return await res.json(); }