Commit 1a06b0ce authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: old chat log import issue

parent 4e6207f8
...@@ -142,13 +142,20 @@ ...@@ -142,13 +142,20 @@
importChats(chats); importChats(chats);
}; };
reader.readAsText(importFiles[0]); if (importFiles.length > 0) {
reader.readAsText(importFiles[0]);
}
} }
const importChats = async (_chats) => { const importChats = async (_chats) => {
for (const chat of _chats) { for (const chat of _chats) {
console.log(chat); console.log(chat);
await createNewChat(localStorage.token, chat.chat);
if (chat.chat) {
await createNewChat(localStorage.token, chat.chat);
} else {
await createNewChat(localStorage.token, chat);
}
} }
await chats.set(await getChatList(localStorage.token)); await chats.set(await getChatList(localStorage.token));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment