From a00c2052a6a99fbb130645712d8a68b59e63290c Mon Sep 17 00:00:00 2001 From: Ty Tremblay Date: Thu, 11 Jan 2024 09:49:59 -0500 Subject: [PATCH] add ability to reset to default config --- src/app.tsx | 58 +++++++++++++++++++++++++--------------------- src/store/store.ts | 4 ++++ 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/app.tsx b/src/app.tsx index 2920f33..2c7c682 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -7,6 +7,7 @@ import Button, { Variant } from './components/core/Button'; import { getQRCodeData, resetSections, + resetToDefaultConfig, uploadConfig, useQRScoutState, } from './store/store'; @@ -102,10 +103,9 @@ export function App() { Reset -
+
-
diff --git a/src/store/store.ts b/src/store/store.ts index 3ba2872..9105b91 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -35,6 +35,10 @@ export const useQRScoutState = createStore( }, ); +export function resetToDefaultConfig() { + useQRScoutState.setState(initialState); +} + export function updateValue(sectionName: string, code: string, data: any) { useQRScoutState.setState( produce((state: QRScoutState) => {