From 90279291fb8ee73962e38aa1603f1d6417b738d1 Mon Sep 17 00:00:00 2001 From: Jehyun Jung Date: Wed, 10 Jul 2024 20:45:37 -0700 Subject: [PATCH] Store values into indexedDB after importing --- src/components/Readfile/Readfile.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/Readfile/Readfile.tsx b/src/components/Readfile/Readfile.tsx index 193972b..41fada0 100644 --- a/src/components/Readfile/Readfile.tsx +++ b/src/components/Readfile/Readfile.tsx @@ -3,6 +3,7 @@ import { useHandleReadFileStatus } from './ReadfileReducer'; import { Card, Button, Modal } from 'react-bootstrap'; import { BsXCircle, BsFileEarmark } from "react-icons/bs"; import TooltipComponent from '../Tooltip/Tooltip'; +import IndexedDB from '../../utils/indexedDB'; interface ReadJSONYAMLfileType { isMulipleFiles?: boolean @@ -16,6 +17,7 @@ const ReadJSONYAMLfile:React.FC = ({setContent, isMulipleF const [ fileType, setFileType ] = useState('json'); const [ selectedSpec, setSelectedSpec ] = useState(); const { isJsonYamlFile, reset, setIsJsonYamlFile } = useHandleReadFileStatus(); + const indexedDBIns = new IndexedDB('editor-db', 'editorContent', 'content'); function onDrop(event: any) { event.preventDefault(); @@ -116,6 +118,7 @@ const ReadJSONYAMLfile:React.FC = ({setContent, isMulipleF setContent(undefined); setTimeout(() => { setContent(selectedSpec); + indexedDBIns.saveContentToDB(JSON.parse(selectedSpec!)); closeFileOnclick(); closeModal && closeModal(); }, 500)