File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -16,19 +16,20 @@ const Page500 = React.lazy(() => import('./views/pages/page500/Page500'))
16
16
17
17
const App = ( ) => {
18
18
const { isColorModeSet, setColorMode } = useColorModes ( 'coreui-free-react-admin-template-theme' )
19
- const theme = useSelector ( ( state ) => state . theme )
19
+ const storedTheme = useSelector ( ( state ) => state . theme )
20
20
21
21
useEffect ( ( ) => {
22
22
const urlParams = new URLSearchParams ( window . location . href . split ( '?' ) [ 1 ] )
23
- if ( urlParams . get ( 'theme' ) ) {
24
- setColorMode ( urlParams . get ( 'theme' ) )
23
+ const theme = urlParams . get ( 'theme' ) . match ( / ^ [ A - Z a - z 0 - 9 \s ] + / ) [ 0 ]
24
+ if ( theme ) {
25
+ setColorMode ( theme )
25
26
}
26
27
27
28
if ( isColorModeSet ( ) ) {
28
29
return
29
30
}
30
31
31
- setColorMode ( theme )
32
+ setColorMode ( storedTheme )
32
33
} , [ ] ) // eslint-disable-line react-hooks/exhaustive-deps
33
34
34
35
return (
You can’t perform that action at this time.
0 commit comments