From d6e1e2ad5c19045bb97d3b4b734b34ce64005fa8 Mon Sep 17 00:00:00 2001 From: yannickFuereder Date: Sat, 28 Oct 2023 01:23:58 +0200 Subject: [PATCH] api keys --- Assets/js/profile.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Assets/js/profile.js b/Assets/js/profile.js index 84baeca..eaaaf52 100644 --- a/Assets/js/profile.js +++ b/Assets/js/profile.js @@ -119,7 +119,7 @@ LoginManager.isLoggedIn().then(async (e) => { initSearchbar(languages, "language_search"); user.api_keys.forEach((key) => { - document.getElementById('apiKeysTable').appendChild(createApiKeyRow(key.client_id, "*************")); + document.getElementById('apiKeysTable').appendChild(createApiKeyRow(key, "*************")); }); }); @@ -145,6 +145,8 @@ function createApiKeyRow(client_id, client_secret) { const td = document.createElement('td'); const deleteBtn = document.createElement('button'); const regenBtn = document.createElement('button'); + deleteBtn.innerText = 'Delete'; + regenBtn.innerText = 'Regenerate'; deleteBtn.addEventListener('click', () => deleteApiKey(client_id)); regenBtn.addEventListener('click', () => regenerateApiKey(client_id)); @@ -177,7 +179,7 @@ async function createApiKey() { return; } - document.getElementById('apiKeysTable').appendChild(createApiKeyRow(res.client_id, res.client_secret)); + document.getElementById('apiKeysTable').appendChild(createApiKeyRow(res.data.clientId, res.data.clientSecret)); } async function regenerateApiKey(clientId) { @@ -186,7 +188,6 @@ async function regenerateApiKey(clientId) { method: 'PUT', headers: { Authorization: 'Bearer ' + LoginManager.getCookie('token'), - 'Content-Type': 'application/json', }, body: "\"" + clientId + "\"", });