forked from Idautterstrom/project-labyrinth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
persisting state + redirect to game if persisted state is availabel +…
… restart action
- Loading branch information
1 parent
88412d5
commit 7fe13d1
Showing
8 changed files
with
408 additions
and
374 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { combineReducers } from '@reduxjs/toolkit' | ||
|
||
import { game } from './game' | ||
import { ui } from './ui' | ||
|
||
export const rootReducer = combineReducers({ game: game.reducer, ui: ui.reducer }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { applyMiddleware, compose, createStore } from '@reduxjs/toolkit' | ||
import thunkMiddleware from 'redux-thunk' | ||
|
||
import { rootReducer } from 'reducers/rootReducer' | ||
|
||
export const setupStore = preloadedState => { | ||
const middlewares = [thunkMiddleware] | ||
const middlewareEnhancer = applyMiddleware(...middlewares) | ||
|
||
const enhancers = [ | ||
middlewareEnhancer, | ||
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), | ||
] | ||
const composedEnhancers = compose(...enhancers) | ||
|
||
const store = createStore(rootReducer, preloadedState, composedEnhancers) | ||
|
||
// if (process.env.NODE_ENV !== 'production' && module.hot) { | ||
// module.hot.accept('./reducers', () => store.replaceReducer(rootReducer)) | ||
// } | ||
|
||
return store | ||
} |