specify profile for new chat via uri

This commit is contained in:
Webifi 2023-08-19 13:09:43 -05:00
parent ed0dbe1188
commit deb75832e7
1 changed files with 6 additions and 1 deletions

View File

@ -1,8 +1,13 @@
<script lang="ts"> <script lang="ts">
import { querystring } from 'svelte-spa-router'
import { addChat } from './Storage.svelte' import { addChat } from './Storage.svelte'
import { replace } from 'svelte-spa-router' import { replace } from 'svelte-spa-router'
import { getProfile } from './Profiles.svelte'
// Create the new chat instance then redirect to it // Create the new chat instance then redirect to it
const chatId = addChat()
const urlParams: URLSearchParams = new URLSearchParams($querystring)
const chatId = urlParams.has('p') ? addChat(getProfile(urlParams.get('p') || '')) : addChat()
replace(`/chat/${chatId}`) replace(`/chat/${chatId}`)
</script> </script>