Spaces:
Running
Running
| import { api } from "./client"; | |
| import type { Role, RoleInput, Team, TeamInput } from "../types"; | |
| export const listRoles = async () => (await api.get<Role[]>("/roles")).data; | |
| export const createRole = async (input: RoleInput) => | |
| (await api.post<Role>("/roles", input)).data; | |
| export const updateRole = async (id: number, input: Partial<RoleInput>) => | |
| (await api.patch<Role>(`/roles/${id}`, input)).data; | |
| export const deleteRole = async (id: number) => | |
| (await api.delete<{ deleted: boolean }>(`/roles/${id}`)).data; | |
| export const listTeams = async () => (await api.get<Team[]>("/teams")).data; | |
| export const createTeam = async (input: TeamInput) => | |
| (await api.post<Team>("/teams", input)).data; | |
| export const updateTeam = async (id: number, input: Partial<TeamInput>) => | |
| (await api.patch<Team>(`/teams/${id}`, input)).data; | |
| export const deleteTeam = async (id: number) => | |
| (await api.delete<{ deleted: boolean }>(`/teams/${id}`)).data; | |