mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
♻️ Rename Redux action for consistent naming
This commit is contained in:
parent
8341d4ec0e
commit
9075679921
3 changed files with 10 additions and 9 deletions
|
@ -122,7 +122,7 @@ export const persist = function* () {
|
|||
*
|
||||
* @return {Action} The action.
|
||||
*/
|
||||
export const connectViaSandbox = function* () {
|
||||
export const connectToSandbox = function* () {
|
||||
yield setIsBusy( true );
|
||||
|
||||
const result = yield { type: ACTION_TYPES.DO_SANDBOX_LOGIN };
|
||||
|
@ -134,14 +134,15 @@ export const connectViaSandbox = function* () {
|
|||
/**
|
||||
* Side effect. Initiates the production login ISU.
|
||||
*
|
||||
* @param {string[]} products Which products/features to display in the ISU popup.
|
||||
* @return {Action} The action.
|
||||
*/
|
||||
export const connectToProduction = function* () {
|
||||
export const connectToProduction = function* ( products = [] ) {
|
||||
yield setIsBusy( true );
|
||||
|
||||
const result = yield {
|
||||
type: ACTION_TYPES.DO_PRODUCTION_LOGIN,
|
||||
products: [ 'EXPRESS_CHECKOUT' ],
|
||||
products,
|
||||
};
|
||||
yield setIsBusy( false );
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ const useHooks = () => {
|
|||
setManualConnectionMode,
|
||||
setClientId,
|
||||
setClientSecret,
|
||||
connectViaSandbox,
|
||||
connectToSandbox,
|
||||
connectViaIdAndSecret,
|
||||
} = useDispatch( STORE_NAME );
|
||||
|
||||
|
@ -72,7 +72,7 @@ const useHooks = () => {
|
|||
setClientSecret: ( value ) => {
|
||||
return savePersistent( setClientSecret, value );
|
||||
},
|
||||
connectViaSandbox,
|
||||
connectToSandbox,
|
||||
connectViaIdAndSecret,
|
||||
wooSettings,
|
||||
};
|
||||
|
@ -89,9 +89,9 @@ export const useBusyState = () => {
|
|||
};
|
||||
|
||||
export const useSandbox = () => {
|
||||
const { isSandboxMode, setSandboxMode, connectViaSandbox } = useHooks();
|
||||
const { isSandboxMode, setSandboxMode, connectToSandbox } = useHooks();
|
||||
|
||||
return { isSandboxMode, setSandboxMode, connectViaSandbox };
|
||||
return { isSandboxMode, setSandboxMode, connectToSandbox };
|
||||
};
|
||||
|
||||
export const useManualConnection = () => {
|
||||
|
|
|
@ -26,12 +26,12 @@ const useCommonConnectionLogic = () => {
|
|||
};
|
||||
|
||||
export const useSandboxConnection = () => {
|
||||
const { connectViaSandbox, isSandboxMode, setSandboxMode } =
|
||||
const { connectToSandbox, isSandboxMode, setSandboxMode } =
|
||||
CommonHooks.useSandbox();
|
||||
const { handleServerError, createErrorNotice } = useCommonConnectionLogic();
|
||||
|
||||
const handleSandboxConnect = async () => {
|
||||
const res = await connectViaSandbox();
|
||||
const res = await connectToSandbox();
|
||||
|
||||
if ( ! res.success || ! res.data ) {
|
||||
handleServerError(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue