hid create and delete role buttons to prevent catastrophe
This commit is contained in:
@@ -10,7 +10,9 @@ export type Role = {
|
||||
const addr = import.meta.env.VITE_APIHOST;
|
||||
|
||||
export async function getRoles(): Promise<Role[]> {
|
||||
const res = await fetch(`${addr}/roles`)
|
||||
const res = await fetch(`${addr}/roles`, {
|
||||
credentials: 'include',
|
||||
})
|
||||
|
||||
if (res.ok) {
|
||||
return res.json() as Promise<Role[]>;
|
||||
@@ -26,11 +28,12 @@ export async function createRole(name: string, color: string, description: strin
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
credentials: 'include',
|
||||
body: JSON.stringify({
|
||||
name,
|
||||
color,
|
||||
description
|
||||
})
|
||||
}),
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
@@ -47,6 +50,7 @@ export async function addMemberToRole(member_id: number, role_id: number): Promi
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
credentials: 'include',
|
||||
body: JSON.stringify({
|
||||
member_id,
|
||||
role_id
|
||||
@@ -83,7 +87,8 @@ export async function removeMemberFromRole(member_id: number, role_id: number):
|
||||
|
||||
export async function deleteRole(role_id: number): Promise<boolean> {
|
||||
const res = await fetch(`${addr}/roles/${role_id}`, {
|
||||
method: "DELETE"
|
||||
method: "DELETE",
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
|
||||
Reference in New Issue
Block a user