Started work on site-wide toke command management & errorHandler

This commit is contained in:
rainbow napkin 2024-12-11 07:16:42 -05:00
parent d516fed309
commit af7f4219a5
12 changed files with 146 additions and 11 deletions

View file

@ -169,6 +169,35 @@ class canopyAdminUtils{
utils.ux.displayResponseError(await response.json());
}
}
async getTokeCommands(){
var response = await fetch(`/api/admin/tokeCommands`,{
method: "GET"
});
if(response.status == 200){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
}
}
async addTokeCommand(command){
var response = await fetch(`/api/admin/tokeCommands`,{
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({command})
});
if(response.status == 200){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
}
}
}
class adminUserList{