mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
♻️ Move REST paths to constants.js
This commit is contained in:
parent
84d2af5f39
commit
ab8f8e81ae
2 changed files with 12 additions and 1 deletions
|
@ -8,6 +8,16 @@
|
|||
*/
|
||||
export const STORE_KEY = 'onboarding';
|
||||
|
||||
/**
|
||||
* REST path to hydrate data of this module by loading data from the WP DB..
|
||||
*
|
||||
* Used by: Resolvers
|
||||
* See: OnboardingRestEndpoint.php
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const REST_HYDRATE_PATH = 'onboarding';
|
||||
|
||||
/**
|
||||
* REST path to persist data of this module to the WP DB.
|
||||
*
|
||||
|
|
|
@ -2,13 +2,14 @@ import { dispatch } from '@wordpress/data';
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { apiFetch } from '@wordpress/data-controls';
|
||||
import { NAMESPACE } from '../constants';
|
||||
import { REST_HYDRATE_PATH } from './constants';
|
||||
import { setIsReady, setOnboardingDetails } from './actions';
|
||||
|
||||
/**
|
||||
* Retrieve settings from the site's REST API.
|
||||
*/
|
||||
export function* getPersistentData() {
|
||||
const path = `${ NAMESPACE }/onboarding`;
|
||||
const path = `${ NAMESPACE }/${ REST_HYDRATE_PATH }`;
|
||||
|
||||
try {
|
||||
const result = yield apiFetch( { path } );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue