Created channel perms schema and api routes.

This commit is contained in:
rainbownapkin 2024-11-23 13:41:48 -05:00
parent 9dbbc4e924
commit 8384e732f3
21 changed files with 250 additions and 20 deletions

View file

@ -236,6 +236,23 @@ class canopyAjaxUtils{
}
}
async setChannelPermissions(chanName, permissionsMap){
var response = await fetch(`/api/channel/permissions`,{
method: "POST",
headers: {
"Content-Type": "application/json"
},
//Unfortunately JSON doesn't natively handle ES6 maps, and god forbid someone update the standard in a way that's backwards compatible...
body: JSON.stringify({chanName, channelPermissionsMap: Object.fromEntries(permissionsMap)})
});
if(response.status == 200){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
}
}
async deleteChannel(chanName, confirm){
var response = await fetch(`/api/channel/delete`,{
method: "POST",