feat: archive chat

This commit is contained in:
Timothy J. Baek 2024-04-20 17:03:39 -05:00
parent 00b01c973e
commit fbd520bf07
5 changed files with 125 additions and 3 deletions

View file

@ -17,7 +17,8 @@
getChatById,
getChatListByTagName,
updateChatById,
getAllChatTags
getAllChatTags,
archiveChatById
} from '$lib/apis/chats';
import { toast } from 'svelte-sonner';
import { fade, slide } from 'svelte/transition';
@ -139,6 +140,11 @@
localStorage.setItem('settings', JSON.stringify($settings));
location.href = '/';
};
const archiveChatHandler = async (id) => {
await archiveChatById(localStorage.token, id);
await chats.set(await getChatList(localStorage.token));
};
</script>
<ShareChatModal bind:show={showShareChatModal} chatId={shareChatId} />
@ -594,7 +600,7 @@
aria-label="Archive"
class=" self-center dark:hover:text-white transition"
on:click={() => {
selectedChatId = chat.id;
archiveChatHandler(chat.id);
}}
>
<ArchiveBox />