add + remove users from organisation

This commit is contained in:
Oliver Bryan
2026-01-01 10:46:54 +00:00
parent 8511c6472c
commit 63fef4a0e9
20 changed files with 560 additions and 32 deletions

View File

@@ -0,0 +1,26 @@
import type { UserRecord } from "@issue/shared";
import { getAuthHeaders, getServerURL } from "@/lib/utils";
import type { ServerQueryInput } from "..";
export async function byUsername({
username,
onSuccess,
onError,
}: {
username: string;
} & ServerQueryInput) {
const url = new URL(`${getServerURL()}/user/by-username`);
url.searchParams.set("username", username);
const res = await fetch(url.toString(), {
headers: getAuthHeaders(),
});
if (!res.ok) {
const error = await res.text();
onError?.(error || `failed to get user (${res.status})`);
} else {
const data = (await res.json()) as UserRecord;
onSuccess?.(data, res);
}
}