Default to last viewed chat when returning to app

This commit is contained in:
Webifi 2023-06-27 12:03:34 -05:00
parent 899ef0137e
commit 421d80a7fa
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { apiKeyStorage, lastChatId, getChat, started } from './Storage.svelte' import { apiKeyStorage, lastChatId, getChat, started } from './Storage.svelte'
import Footer from './Footer.svelte' import Footer from './Footer.svelte'
// import { replace } from 'svelte-spa-router' import { replace } from 'svelte-spa-router'
import { onMount } from 'svelte' import { onMount } from 'svelte'
$: apiKey = $apiKeyStorage $: apiKey = $apiKeyStorage
@ -11,9 +11,9 @@ onMount(() => {
$started = true $started = true
// console.log('started', apiKey, $lastChatId, getChat($lastChatId)) // console.log('started', apiKey, $lastChatId, getChat($lastChatId))
if (apiKey && getChat($lastChatId)) { if (apiKey && getChat($lastChatId)) {
// const chatId = $lastChatId const chatId = $lastChatId
$lastChatId = 0 $lastChatId = 0
// replace(`/chat/${chatId}`) replace(`/chat/${chatId}`)
} }
} }
$lastChatId = 0 $lastChatId = 0