♻️ Rename Redux action for consistent naming

This commit is contained in:
Philipp Stracker 2024-12-03 17:54:09 +01:00
parent 8341d4ec0e
commit 9075679921
No known key found for this signature in database
3 changed files with 10 additions and 9 deletions

View file

@ -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 );

View file

@ -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 = () => {

View file

@ -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(