Finished basic channel ban DB mgmt and ajax calls.
This commit is contained in:
parent
2b52fe7f2f
commit
ef79e9941c
4 changed files with 293 additions and 3 deletions
|
|
@ -324,8 +324,8 @@ class canopyAjaxUtils{
|
|||
}
|
||||
}
|
||||
|
||||
async getChannelRank(channel){
|
||||
var response = await fetch(`/api/channel/rank?chanName=${channel}`,{
|
||||
async getChannelRank(chanName){
|
||||
var response = await fetch(`/api/channel/rank?chanName=${chanName}`,{
|
||||
method: "GET"
|
||||
});
|
||||
|
||||
|
|
@ -380,6 +380,53 @@ class canopyAjaxUtils{
|
|||
utils.ux.displayResponseError(await response.json());
|
||||
}
|
||||
}
|
||||
|
||||
async getChanBans(chanName){
|
||||
var response = await fetch(`/api/channel/ban?chanName=${chanName}`,{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
|
||||
if(response.status == 200){
|
||||
return await response.json();
|
||||
}else{
|
||||
utils.ux.displayResponseError(await response.json());
|
||||
}
|
||||
}
|
||||
|
||||
async chanBan(chanName, user, expirationDays, banAlts){
|
||||
var response = await fetch(`/api/channel/ban`,{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({chanName, user, expirationDays, banAlts})
|
||||
});
|
||||
|
||||
if(response.status == 200){
|
||||
return await response.json();
|
||||
}else{
|
||||
utils.ux.displayResponseError(await response.json());
|
||||
}
|
||||
}
|
||||
|
||||
async chanUnban(chanName, user){
|
||||
var response = await fetch(`/api/channel/ban`,{
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({chanName, user})
|
||||
});
|
||||
|
||||
if(response.status == 200){
|
||||
return await response.json();
|
||||
}else{
|
||||
utils.ux.displayResponseError(await response.json());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const utils = new canopyUtils()
|
||||
Loading…
Add table
Add a link
Reference in a new issue