This commit is contained in:
Timothy Jaeryang Baek
2026-03-21 18:10:01 -05:00
parent bb3526f4e4
commit 5b026b2a3e
5 changed files with 22 additions and 6 deletions
+2 -6
View File
@@ -2632,12 +2632,8 @@
currentChatPage.set(1);
initNewChat();
await goto('/');
getChatList(localStorage.token, $currentChatPage).then((chats) => {
chats.set(chats);
});
getPinnedChatList(localStorage.token).then((pinnedChats) => {
pinnedChats.set(pinnedChats);
});
chats.set(await getChatList(localStorage.token, $currentChatPage));
pinnedChats.set(await getPinnedChatList(localStorage.token));
toast.success($i18n.t('Chat archived.'));
} catch (error) {
console.error('Error archiving chat:', error);
@@ -21,6 +21,7 @@
export let show = false;
export let onUpdate = () => {};
export let onDelete: (id: string) => void = () => {};
let loading = false;
let chatList: any[] | null = null;
@@ -158,6 +159,9 @@
onUpdate={() => {
init();
}}
onDelete={(id) => {
onDelete(id);
}}
loadHandler={loadMoreChats}
{unarchiveHandler}
>
@@ -50,6 +50,7 @@
let showDeleteConfirmDialog = false;
export let onUpdate = () => {};
export let onDelete: (id: string) => void = () => {};
export let loadHandler: null | Function = null;
export let unarchiveHandler: null | Function = null;
@@ -69,6 +70,9 @@
toast.error(`${error}`);
});
if (res) {
onDelete(chatId);
}
onUpdate();
};
</script>
+6
View File
@@ -592,6 +592,12 @@
onUpdate={async () => {
await initChatList();
}}
onDelete={(id) => {
if ($chatId === id) {
chatId.set('');
window.history.replaceState({}, '', '/');
}
}}
/>
<ChannelModal
@@ -155,6 +155,12 @@
const archiveChatHandler = async (id) => {
try {
await archiveChatById(localStorage.token, id);
if ($chatId === id) {
chatId.set('');
window.history.replaceState({}, '', '/');
}
dispatch('change');
toast.success($i18n.t('Chat archived.'));
} catch (error) {