diff --git a/svelte/src/user_home/APIKeys.svelte b/svelte/src/user_home/APIKeys.svelte index e827446..2f41e39 100644 --- a/svelte/src/user_home/APIKeys.svelte +++ b/svelte/src/user_home/APIKeys.svelte @@ -35,6 +35,23 @@ const load_keys = async () => { } }; +const create_key = async () => { + loading = true + try { + const resp = await fetch( + window.api_endpoint+"/user/session", + { method: "POST" } + ); + if(resp.status >= 400) { + throw new Error(await resp.text()); + } + } catch (err) { + alert("Failed to create new API key! "+err) + } + + load_keys(); +} + const logout = async (key) => { loading = true @@ -78,6 +95,13 @@ const logout = async (key) => { lock_open Show API keys + {:else} +
+
+ +
{/if}

@@ -124,4 +148,11 @@ const logout = async (key) => { width: 100px; z-index: 1000; } +.toolbar { + display: flex; + flex-direction: row; + width: 100%; +} +.toolbar > * { flex: 0 0 auto; } +.toolbar_spacer { flex: 1 1 auto; }