From 454e7c1a6dcdccd6df098dc945623d10186c97e7 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Thu, 21 Nov 2024 17:42:48 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Small=20code=20cleanup?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../resources/js/data/common/actions.js | 8 +--
.../resources/js/data/onboarding/actions.js | 66 ++++---------------
2 files changed, 14 insertions(+), 60 deletions(-)
diff --git a/modules/ppcp-settings/resources/js/data/common/actions.js b/modules/ppcp-settings/resources/js/data/common/actions.js
index 63ace933b..edf6d8d4b 100644
--- a/modules/ppcp-settings/resources/js/data/common/actions.js
+++ b/modules/ppcp-settings/resources/js/data/common/actions.js
@@ -101,11 +101,9 @@ export const setClientSecret = ( clientSecret ) => ( {
* @return {Action} The action.
*/
export const persist = function* () {
- yield setIsBusy( true );
- yield {
- type: ACTION_TYPES.DO_PERSIST_DATA,
- };
- yield setIsBusy( false );
+ const data = yield select( STORE_NAME ).persistentData();
+
+ yield { type: ACTION_TYPES.DO_PERSIST_DATA, data };
};
/**
diff --git a/modules/ppcp-settings/resources/js/data/onboarding/actions.js b/modules/ppcp-settings/resources/js/data/onboarding/actions.js
index 84bca8e1a..1742048e1 100644
--- a/modules/ppcp-settings/resources/js/data/onboarding/actions.js
+++ b/modules/ppcp-settings/resources/js/data/onboarding/actions.js
@@ -25,17 +25,6 @@ import { STORE_NAME } from './constants';
*/
export const reset = () => ( { type: ACTION_TYPES.RESET } );
-/**
- * Transient. Marks the onboarding details as "ready", i.e., fully initialized.
- *
- * @param {boolean} isReady
- * @return {Action} The action.
- */
-export const setIsReady = ( isReady ) => ( {
- type: ACTION_TYPES.SET_TRANSIENT,
- payload: { isReady },
-} );
-
/**
* Persistent. Set the full onboarding details, usually during app initialization.
*
@@ -47,6 +36,17 @@ export const hydrate = ( payload ) => ( {
payload,
} );
+/**
+ * Transient. Marks the onboarding details as "ready", i.e., fully initialized.
+ *
+ * @param {boolean} isReady
+ * @return {Action} The action.
+ */
+export const setIsReady = ( isReady ) => ( {
+ type: ACTION_TYPES.SET_TRANSIENT,
+ payload: { isReady },
+} );
+
/**
* Persistent.Set the "onboarding completed" flag which shows or hides the wizard.
*
@@ -69,50 +69,6 @@ export const setStep = ( step ) => ( {
payload: { step },
} );
-/**
- * Persistent. Sets the sandbox mode on or off.
- *
- * @param {boolean} useSandbox
- * @return {Action} The action.
- */
-export const setSandboxMode = ( useSandbox ) => ( {
- type: ACTION_TYPES.SET_PERSISTENT,
- payload: { useSandbox },
-} );
-
-/**
- * Persistent. Toggles the "Manual Connection" mode on or off.
- *
- * @param {boolean} useManualConnection
- * @return {Action} The action.
- */
-export const setManualConnectionMode = ( useManualConnection ) => ( {
- type: ACTION_TYPES.SET_PERSISTENT,
- payload: { useManualConnection },
-} );
-
-/**
- * Persistent. Changes the "client ID" value.
- *
- * @param {string} clientId
- * @return {Action} The action.
- */
-export const setClientId = ( clientId ) => ( {
- type: ACTION_TYPES.SET_PERSISTENT,
- payload: { clientId },
-} );
-
-/**
- * Persistent. Changes the "client secret" value.
- *
- * @param {string} clientSecret
- * @return {Action} The action.
- */
-export const setClientSecret = ( clientSecret ) => ( {
- type: ACTION_TYPES.SET_PERSISTENT,
- payload: { clientSecret },
-} );
-
/**
* Persistent. Sets the "isCasualSeller" value.
*