specify profile for new chat via uri
This commit is contained in:
parent
ed0dbe1188
commit
deb75832e7
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue