mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
♻️ Create isolated onboarding Redux store
This commit is contained in:
parent
9e4d0c0819
commit
79174459d8
5 changed files with 26 additions and 45 deletions
|
@ -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..
|
||||
|
|
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue