Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static createStore(storeInitConfig?: Rematch.InitConfig): Rematch.RematchStore {
if (!storeInitConfig) {
storeInitConfig = {};
}
if (!storeInitConfig.plugins) {
storeInitConfig.plugins = [];
}
// activate "immer"
storeInitConfig.plugins.push(immerPlugin());
//console.log('StateManager initConfig', storeInitConfig);
// TODO: Construct config based on StoreConfig configurable using @Store(storeConfig: StoreConfig)
const store = Rematch.init(storeInitConfig);
StateManager.setStore(store);
return store;
}
import * as models from './models'
import { init } from '@rematch/core'
import immerPlugin from '@rematch/immer'
import createLoadingPlugin from '@rematch/loading'
const immer = immerPlugin()
// see options API below
const options = {}
const loading = createLoadingPlugin(options)
const store = init({ models, plugins: [immer, loading] })
export default store
import { init, RematchRootState, RematchDispatch } from '@rematch/core'
import immerPlugin from '@rematch/immer'
import dashboard from '_state/appState'
const immer = immerPlugin()
const models = {
dashboard,
}
export const store = init({
models,
plugins: [immer],
})
export type Store = typeof store
export type RootState = RematchRootState
export type RootDispatch = RematchDispatch
export default store