Fixed API-Key UI

This commit is contained in:
Mawoka
2022-09-29 18:46:45 +02:00
parent 4f220bf810
commit 375317c3c6
@@ -105,8 +105,10 @@
}; };
const delete_api_key = async (key: string) => { const delete_api_key = async (key: string) => {
await fetch(`/api/v1/users/api_keys?api_key=${key}`, { method: 'DELETE' }); if (confirm('Do you really want to delete this API-Key?')) {
api_keys = get_api_keys(); await fetch(`/api/v1/users/api_keys?api_key=${key}`, { method: 'DELETE' });
api_keys = get_api_keys();
}
}; };
const getSessions = async () => { const getSessions = async () => {
@@ -209,13 +211,16 @@
<Spinner /> <Spinner />
{:then keys} {:then keys}
{#each keys as key} {#each keys as key}
<p <div>
on:contextmenu|preventDefault={() => {
delete_api_key(key.key);
}}
>
{key.key} {key.key}
</p> <button
on:click={() => {
delete_api_key(key.key);
}}
class="admin-button"
>Delete
</button>
</div>
{/each} {/each}
{/await} {/await}
</div> </div>