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'))
1616
1717const App = ( ) => {
1818 const { isColorModeSet, setColorMode } = useColorModes ( 'coreui-free-react-admin-template-theme' )
19- const theme = useSelector ( ( state ) => state . theme )
19+ const storedTheme = useSelector ( ( state ) => state . theme )
2020
2121 useEffect ( ( ) => {
2222 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 )
2526 }
2627
2728 if ( isColorModeSet ( ) ) {
2829 return
2930 }
3031
31- setColorMode ( theme )
32+ setColorMode ( storedTheme )
3233 } , [ ] ) // eslint-disable-line react-hooks/exhaustive-deps
3334
3435 return (
You can’t perform that action at this time.
0 commit comments