export type Rank = { id: number name: string short_name: string sortOrder: number } // @ts-ignore const addr = import.meta.env.VITE_APIHOST; export async function getRanks(): Promise { const res = await fetch(`${addr}/ranks`) if (res.ok) { return res.json() } else { console.error("Something went wrong approving the application") } } // Placeholder: submit a rank change export async function submitRankChange(member_id: number, rank_id: number, date: string): Promise<{ ok: boolean }> { const res = await fetch(`${addr}/memberRanks`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ change: { member_id, rank_id, date } }), }) if (res.ok) { return { ok: true } } else { console.error("Failed to submit rank change") return { ok: false } } }