♻️ Create isolated onboarding Redux store

This commit is contained in:
Philipp Stracker 2024-11-20 16:45:08 +01:00
parent 9e4d0c0819
commit 79174459d8
No known key found for this signature in database
5 changed files with 26 additions and 45 deletions

View file

@ -1,12 +1,11 @@
/**
* Name of the module-store in the main Redux store.
* Helps to isolate data.
* Name of the Redux store module.
*
* Used by: Reducer, Selector, Index
*
* @type {string}
*/
export const STORE_KEY = 'onboarding';
export const STORE_NAME = 'wc/paypal/onboarding';
/**
* REST path to hydrate data of this module by loading data from the WP DB..

View file

@ -1,8 +1,26 @@
import { STORE_KEY } from './constants';
import { createReduxStore, register } from '@wordpress/data';
import { controls as wpControls } from '@wordpress/data-controls';
import { STORE_NAME } from './constants';
import reducer from './reducer';
import * as selectors from './selectors';
import * as actions from './actions';
import * as resolvers from './resolvers';
import * as hooks from './hooks';
import { controls } from './controls';
export { reducer, selectors, actions, resolvers, controls, STORE_KEY };
export const initStore = () => {
const store = createReduxStore( STORE_NAME, {
reducer,
controls: { ...wpControls, ...controls },
actions,
selectors,
resolvers,
} );
register( store );
};
export { hooks };
export { STORE_NAME };