first pass of new UI

This commit is contained in:
2025-12-18 15:12:22 -05:00
parent f3e35f3f6a
commit 8c04d2cf05
7 changed files with 240 additions and 164 deletions

View File

@@ -1,10 +1,5 @@
export type Role = {
id: number;
name: string;
color: string;
description: string | null;
members: any[];
};
import { Member, MemberLight } from "@shared/types/member";
import { Role } from "@shared/types/roles";
// @ts-ignore
const addr = import.meta.env.VITE_APIHOST;
@@ -22,6 +17,30 @@ export async function getRoles(): Promise<Role[]> {
}
}
export async function getRoleDetails(id: number): Promise<Role> {
const res = await fetch(`${addr}/roles/${id}`, {
credentials: 'include',
})
if (res.ok) {
return res.json() as Promise<Role>;
} else {
throw new Error("Could not load role");
}
}
export async function getRoleMembers(id: number): Promise<MemberLight[]> {
const res = await fetch(`${addr}/roles/${id}/members`, {
credentials: 'include',
})
if (res.ok) {
return res.json();
} else {
throw new Error("Could not load members");
}
}
export async function createRole(name: string, color: string, description: string | null): Promise<Role | null> {
const res = await fetch(`${addr}/roles`, {
method: "POST",