mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
17 lines
485 B
TypeScript
17 lines
485 B
TypeScript
import type { OrganisationResponse } from "@sprint/shared";
|
|
import { getServerURL } from "@/lib/utils";
|
|
import { getErrorMessage } from "..";
|
|
|
|
export async function byUser(): Promise<OrganisationResponse[]> {
|
|
const res = await fetch(`${getServerURL()}/organisations/by-user`, {
|
|
credentials: "include",
|
|
});
|
|
|
|
if (!res.ok) {
|
|
const message = await getErrorMessage(res, `failed to get organisations (${res.status})`);
|
|
throw new Error(message);
|
|
}
|
|
|
|
return res.json();
|
|
}
|