@@ -10,7 +10,7 @@ import { actionCreators, store } from './store';
1010import { State } from './store/reducers' ;
1111
1212// Utils
13- import { checkVersion , decodeToken } from './utility' ;
13+ import { checkVersion , decodeToken , parsePABToTheme } from './utility' ;
1414
1515// Routes
1616import { Home } from './components/Home/Home' ;
@@ -31,7 +31,7 @@ export const App = (): JSX.Element => {
3131 const { config, loading } = useSelector ( ( state : State ) => state . config ) ;
3232
3333 const dispath = useDispatch ( ) ;
34- const { fetchQueries, setTheme, logout, createNotification } =
34+ const { fetchQueries, setTheme, logout, createNotification, fetchThemes } =
3535 bindActionCreators ( actionCreators , dispath ) ;
3636
3737 useEffect ( ( ) => {
@@ -51,9 +51,12 @@ export const App = (): JSX.Element => {
5151 }
5252 } , 1000 ) ;
5353
54+ // load themes
55+ fetchThemes ( ) ;
56+
5457 // set user theme if present
5558 if ( localStorage . theme ) {
56- setTheme ( localStorage . theme ) ;
59+ setTheme ( parsePABToTheme ( localStorage . theme ) ) ;
5760 }
5861
5962 // check for updated
@@ -68,7 +71,7 @@ export const App = (): JSX.Element => {
6871 // If there is no user theme, set the default one
6972 useEffect ( ( ) => {
7073 if ( ! loading && ! localStorage . theme ) {
71- setTheme ( config . defaultTheme , false ) ;
74+ setTheme ( parsePABToTheme ( config . defaultTheme ) , false ) ;
7275 }
7376 } , [ loading ] ) ;
7477
0 commit comments