Allow passing in the API key as a query parameter

This commit is contained in:
Niek van der Maas 2023-03-06 16:14:22 +01:00
parent ac786b3dc8
commit d512aa83bc
1 changed files with 6 additions and 0 deletions

View File

@ -10,6 +10,12 @@
$: sortedChats = $chatsStorage.sort((a, b) => b.id - a.id); $: sortedChats = $chatsStorage.sort((a, b) => b.id - a.id);
$: apiKey = $apiKeyStorage; $: apiKey = $apiKeyStorage;
// Check if the API key is passed in as a "key" query parameter - if so, save it
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has("key")) {
apiKeyStorage.set(urlParams.get("key")!);
}
let activeChatId: number; let activeChatId: number;
</script> </script>