-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from newfold-labs/PRESS2-367-settings-api-res…
…t-route-param Update Ecommerce steps to use rest_route
- Loading branch information
Showing
4 changed files
with
26 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
import { onboardingRestBase } from '../../../constants'; | ||
import { onboardingRestBase, wpRestBase } from '../../../constants'; | ||
|
||
export const onboardingRestURL = (api) => { | ||
return (`${ onboardingRestBase }/${ api }` + ( window.nfdOnboarding?.currentFlow ? `&flow=${window.nfdOnboarding.currentFlow}` : '')); | ||
} | ||
export const onboardingRestURL = ( api ) => { | ||
return ( | ||
`${ onboardingRestBase }/${ api }` + | ||
( window.nfdOnboarding?.currentFlow | ||
? `&flow=${ window.nfdOnboarding.currentFlow }` | ||
: '' ) | ||
); | ||
}; | ||
|
||
export const wpRestURL = ( api ) => { | ||
return `${ wpRestBase }/${ api }`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import apiFetch from '@wordpress/api-fetch'; | ||
import { wpRestURL } from './common'; | ||
|
||
export const isEmpty = (object) => Object.keys(object).length === 0; | ||
export const isEmpty = ( object ) => Object.keys( object ).length === 0; | ||
|
||
export async function fetchWPSettings() { | ||
return apiFetch({ path: '/wp/v2/settings' }); | ||
return apiFetch( { url: wpRestURL( 'settings' ) } ); | ||
} | ||
|
||
export async function updateWPSettings(data) { | ||
return apiFetch({ path: '/wp/v2/settings', method: 'POST', data }); | ||
export async function updateWPSettings( data ) { | ||
return apiFetch( { url: wpRestURL( 'settings' ), method: 'POST', data } ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters