diff --git a/src/components/App.tsx b/src/components/App.tsx index ce095fa..6d8de3c 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react" +import React, { useEffect, useState } from "react" import copy from "copy-to-clipboard" import RetakesConfig from "../types/RetakesConfig" import AllDecks from "./AllDecks" @@ -10,6 +10,19 @@ const App: React.FC = () => { const [showExport,setShowExport] = useState(false) const [exportText,setExportText] = useState("") + useEffect(()=>{ + // Load saved config + const retakesJSON = window.localStorage.getItem("retakesJSON") + if (retakesJSON){ + try{ + const parsedConfig: RetakesConfig = JSON.parse(retakesJSON) + setRetakesConfig(parsedConfig) + }catch(err){ + window.localStorage.removeItem("retakesJSON") + } + } + },[]) + return (