This commit is contained in:
Mckay Wrigley 2023-03-25 10:13:51 -06:00
parent 92eab6c634
commit 3f09a4c355
1 changed files with 3 additions and 3 deletions

View File

@ -1,16 +1,16 @@
import { ChatFolder, Conversation } from "@/types";
import { cleanConversationHistory } from "@/utils/app/clean";
import { IconFileImport } from "@tabler/icons-react";
import { useTranslation } from "next-i18next";
import { FC } from "react";
import { SidebarButton } from "./SidebarButton";
import { useTranslation } from "next-i18next";
interface Props {
onImport: (data: { conversations: Conversation[]; folders: ChatFolder[] }) => void;
}
export const Import: FC<Props> = ({ onImport }) => {
const { t} = useTranslation('sidebar')
const { t } = useTranslation("sidebar");
return (
<>
<input
@ -27,7 +27,7 @@ export const Import: FC<Props> = ({ onImport }) => {
reader.onload = (e) => {
let json = JSON.parse(e.target?.result as string);
if (!json.folders) {
if (json && !json.folders) {
json = { history: cleanConversationHistory(json), folders: [] };
}