const API_BASE = "http://localhost:4567/api"; export async function getRecruitments() { const res = await fetch(`${API_BASE}/recruitments`); return await res.json(); } export async function postRecruitment(data) { const res = await fetch(`${API_BASE}/recruitments`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data), }); return await res.json(); } export async function getApplies() { const res = await fetch(`${API_BASE}/applies`); return await res.json(); } export async function postApply(data) { const res = await fetch(`${API_BASE}/applies`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data), }); return await res.json(); } export async function getMatches() { const res = await fetch(`${API_BASE}/matches`); return await res.json(); } export async function postMatch(data) { const res = await fetch(`${API_BASE}/matches`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data), }); return await res.json(); } export async function getMessages(match_id) { const res = await fetch(`${API_BASE}/messages?match_id=${match_id}`); return await res.json(); } export async function postMessage(data) { const res = await fetch(`${API_BASE}/messages`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(data), }); return await res.json(); }