Skip to content

Commit

Permalink
Store values into indexedDB after importing
Browse files Browse the repository at this point in the history
  • Loading branch information
congmul committed Jul 11, 2024
1 parent b2a746b commit 9027929
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/Readfile/Readfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +17,7 @@ const ReadJSONYAMLfile:React.FC<ReadJSONYAMLfileType> = ({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();
Expand Down Expand Up @@ -116,6 +118,7 @@ const ReadJSONYAMLfile:React.FC<ReadJSONYAMLfileType> = ({setContent, isMulipleF
setContent(undefined);
setTimeout(() => {
setContent(selectedSpec);
indexedDBIns.saveContentToDB(JSON.parse(selectedSpec!));
closeFileOnclick();
closeModal && closeModal();
}, 500)
Expand Down

0 comments on commit 9027929

Please sign in to comment.