working on client creation

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-07-22 19:55:22 +02:00
parent 59b9976dbf
commit 1c0ef0e257
20 changed files with 167 additions and 85 deletions

View File

@@ -0,0 +1,37 @@
function addClient(){
disable('button');
var newData = {
client_id : getValue('client-id'),
name : getValue('client-name'),
secret : getValue('client-secret'),
redirect_uri : getValue('redirect-urls').split("\n")
};
fetch(api+'/add/client',{
method : 'POST',
headers : {
'Content-Type': 'application/json'
},
body : JSON.stringify(newData)
}).then(handleClientdResponse);
setText('button','sent…');
setTimeout(function(){
setText('button','Add client');
enable('button');
},10000);
}
function handleClientdResponse(response){
if (response.ok){
redirect("clients.html");
} else {
setText('button','Failed!');
enable('button');
}
}
function checkPermissions(){
if (user && !user.permissions.includes('MANAGE_CLIENTS')) redirect("index.html");
}
setTimeout(checkPermissions,100);