Skip to content

Commit

Permalink
refactor: refactor debugMode logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanzyTHEbar committed May 3, 2023
1 parent 41205eb commit 37f8023
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions GUI/ETVR/src/routes/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const AppRoutes: Component = () => {
const { setCameraWS, setCameraStatus, getCameras } = useAppCameraContext()
const {
setEnableMDNS,
setDebugMode,
setScanForCamerasOnStartup,
getEnableMDNS,
getScanForCamerasOnStartup,
Expand Down Expand Up @@ -56,6 +57,7 @@ const AppRoutes: Component = () => {
)

setEnableMDNS(settings.enableMDNS)
setDebugMode(settings.debugMode)
setScanForCamerasOnStartup(settings.scanForCamerasOnStartup)
}
})
Expand Down
6 changes: 3 additions & 3 deletions GUI/ETVR/src/store/context/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface AppContext {
getScanForCamerasOnStartup: Accessor<boolean>
getStopAlgoBackend: Accessor<boolean>
setEnableMDNS: (flag: boolean | undefined) => void
setDebugMode: (mode: DebugMode) => void
setDebugMode: (mode: DebugMode | undefined) => void
setScanForCamerasOnStartup: (flag: boolean | undefined) => void
setStopAlgoBackend: (flag: boolean) => void
}
Expand All @@ -30,10 +30,10 @@ export const AppProvider: Component<Context> = (props) => {

const [state, setState] = createStore<AppStore>(defaultState)

const setDebugMode = (mode: DebugMode) => {
const setDebugMode = (mode: DebugMode | undefined) => {
setState(
produce((s) => {
s.debugMode = mode
s.debugMode = mode || 'info'
}),
)
}
Expand Down

0 comments on commit 37f8023

Please sign in to comment.