Ejemplo n.º 1
0
export const createTestStore = async ({ publicApp = false, embedApp = false } = {}) => {
    hasFinishedCreatingStore = false;
    hasStartedCreatingStore = true;

    const history = useRouterHistory(createMemoryHistory)();
    const getRoutes = publicApp ? getPublicRoutes : (embedApp ? getEmbedRoutes : getNormalRoutes);
    const reducers = (publicApp || embedApp) ? publicReducers : normalReducers;
    const store = getStore(reducers, history, undefined, (createStore) => testStoreEnhancer(createStore, history, getRoutes));
    store._setFinalStoreInstance(store);

    if (!publicApp) {
        await store.dispatch(refreshSiteSettings());
    }

    hasFinishedCreatingStore = true;

    return store;
}
Ejemplo n.º 2
0
export const StaticMetadataProvider = ({ children }) => (
  <Provider store={getStore({ metadata: nopMetadataReducer }, null, state)}>
    {children}
  </Provider>
);
Ejemplo n.º 3
0
export const StaticEntitiesProvider = ({ children }) => (
  <Provider store={getStore({ entities: nopEntitiesReducer }, null, state)}>
    {children}
  </Provider>
);