aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/redux/store.ts
blob: 88d964bbc5528484bd6891401e0f91d61f919c5a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import * as _ from 'lodash';
import { createStore, Store as ReduxStore } from 'redux';
import { devToolsEnhancer } from 'redux-devtools-extension/developmentOnly';

import { INITIAL_STATE, reducer, State } from './reducer';

export type Store = ReduxStore<State>;

export const store = {
    create: (withState: Partial<State>): Store => {
        const allInitialState = {
            ...INITIAL_STATE,
            ...withState,
        };
        return createStore(reducer, allInitialState, devToolsEnhancer({}));
    },
};