Add new api token generation dialog

This commit is contained in:
Johannes Zellner
2025-01-15 12:31:35 +01:00
parent 467921dbf6
commit 1dd5f63a11
4 changed files with 194 additions and 26 deletions
+13
View File
@@ -19,6 +19,19 @@ function create(origin, accessToken) {
return result.body.tokens;
},
async add(name, scope) {
let error, result;
try {
result = await fetcher.post(`${origin}/api/v1/tokens`, { name, scope }, { access_token: accessToken });
} catch (e) {
error = e;
}
if (error) throw error;
if (result.status !== 201) throw result;
return result.body;
},
async remove(id) {
let error, result;
try {