2022-08-17 19:02:50 +00:00
|
|
|
/*
|
|
|
|
* redux store for windows / popups
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* eslint-disable no-console */
|
|
|
|
|
|
|
|
import {
|
2022-08-18 12:13:15 +00:00
|
|
|
applyMiddleware, createStore, combineReducers,
|
2022-08-17 19:02:50 +00:00
|
|
|
} from 'redux';
|
|
|
|
import thunk from 'redux-thunk';
|
|
|
|
import { persistStore } from 'redux-persist';
|
|
|
|
|
|
|
|
/*
|
|
|
|
* reducers
|
|
|
|
*/
|
|
|
|
import sharedReducers from './sharedReducers';
|
|
|
|
import canvas from './reducers/canvas';
|
|
|
|
import win from './reducers/win';
|
|
|
|
|
|
|
|
/*
|
|
|
|
* middleware
|
|
|
|
*/
|
2022-08-19 00:56:24 +00:00
|
|
|
import parent from './middleware/parent';
|
2022-08-17 19:02:50 +00:00
|
|
|
|
|
|
|
const reducers = combineReducers({
|
|
|
|
...sharedReducers,
|
|
|
|
canvas,
|
|
|
|
win,
|
|
|
|
});
|
|
|
|
|
|
|
|
const store = createStore(
|
|
|
|
reducers,
|
2022-08-18 12:13:15 +00:00
|
|
|
applyMiddleware(
|
|
|
|
thunk,
|
2022-08-19 00:56:24 +00:00
|
|
|
parent,
|
2022-08-17 19:02:50 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2022-08-19 19:42:58 +00:00
|
|
|
export const persistor = persistStore(store, {}, () => {
|
|
|
|
window.addEventListener('message', store.dispatch);
|
|
|
|
store.dispatch({ type: 'HYDRATED' });
|
|
|
|
});
|
2022-08-17 19:02:50 +00:00
|
|
|
|
|
|
|
export default store;
|