Skip to content

Commit 005fdbc

Browse files
authored
Merge pull request #109 from ram-prasad23/darkmode
fix: netlify build fail due to typescript bug fixed
2 parents 8f7ff3f + 3523ab4 commit 005fdbc

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { HelmetProvider } from 'react-helmet-async';
55
import { StylesContext } from './context';
66
import routes from './routes/routes.tsx';
77
import { useSelector } from 'react-redux';
8-
8+
import { RootState } from './redux/store';
99
import './App.css';
1010

1111
// color palettes: triadic #A1A7CB, #CBA1A7, #A7CBA1

src/layouts/app/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { NProgress } from '../../components';
3838
import { PATH_LANDING } from '../../constants';
3939
import { useSelector, useDispatch } from 'react-redux';
4040
import { toggleTheme } from '../../redux/theme/themeSlice.ts';
41-
41+
import { RootState } from '../../redux/store.ts';
4242
const { Content } = Layout;
4343

4444
type AppLayoutProps = {

src/redux/store.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
11
import { configureStore, combineReducers } from '@reduxjs/toolkit';
2-
import themeReducer from './theme/themeSlice';
2+
import themeReducer, { ThemeState } from './theme/themeSlice';
33
import { persistReducer, persistStore, PersistConfig } from 'redux-persist';
44
import storage from 'redux-persist/lib/storage';
55

6+
// Define the state shape
7+
interface RootState {
8+
theme: ThemeState;
9+
}
10+
11+
// Combine reducers
612
const rootReducer = combineReducers({
713
theme: themeReducer,
814
});
915

10-
const persistConfig: PersistConfig<any> = {
16+
// Persist config with RootState
17+
const persistConfig: PersistConfig<RootState> = {
1118
key: 'root',
1219
storage,
1320
version: 1,
1421
};
1522

1623
const persistedReducer = persistReducer(persistConfig, rootReducer);
1724

25+
// Configure store with persisted reducer
1826
export const store = configureStore({
1927
reducer: persistedReducer,
2028
middleware: (getDefaultMiddleware) =>
21-
getDefaultMiddleware({ serializableCheck: false }),
29+
getDefaultMiddleware({
30+
serializableCheck: false,
31+
}),
2232
});
2333

34+
// Persistor
2435
export const persistor = persistStore(store);
36+
37+
// Type for RootState
38+
export type { RootState };

src/redux/theme/themeSlice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createSlice } from '@reduxjs/toolkit';
22

3-
interface ThemeState {
3+
export interface ThemeState {
44
mytheme: string;
55
}
66

0 commit comments

Comments
 (0)