mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
♻️ Shorten hook property name
This commit is contained in:
parent
3840352c54
commit
fbb4420b80
2 changed files with 13 additions and 19 deletions
|
@ -7,10 +7,8 @@ import OnboardingHeader from '../Components/OnboardingHeader';
|
|||
import OptionalPaymentMethods from '../Components/OptionalPaymentMethods';
|
||||
|
||||
const StepPaymentMethods = ( {} ) => {
|
||||
const {
|
||||
areOptionalPaymentMethodsEnabled,
|
||||
setAreOptionalPaymentMethodsEnabled,
|
||||
} = OnboardingHooks.useOptionalPaymentMethods();
|
||||
const { optionalMethods, setOptionalMethods } =
|
||||
OnboardingHooks.useOptionalPaymentMethods();
|
||||
|
||||
return (
|
||||
<div className="ppcp-r-page-optional-payment-methods">
|
||||
|
@ -19,8 +17,8 @@ const StepPaymentMethods = ( {} ) => {
|
|||
<OptionSelector
|
||||
multiSelect={ false }
|
||||
options={ methodChoices }
|
||||
onChange={ setAreOptionalPaymentMethodsEnabled }
|
||||
value={ areOptionalPaymentMethodsEnabled }
|
||||
onChange={ setOptionalMethods }
|
||||
value={ optionalMethods }
|
||||
/>
|
||||
|
||||
<PricingDescription />
|
||||
|
|
|
@ -36,10 +36,9 @@ const useHooks = () => {
|
|||
const [ completed, setCompleted ] = usePersistent( 'completed' );
|
||||
const [ isCasualSeller, setIsCasualSeller ] =
|
||||
usePersistent( 'isCasualSeller' );
|
||||
const [
|
||||
areOptionalPaymentMethodsEnabled,
|
||||
setAreOptionalPaymentMethodsEnabled,
|
||||
] = usePersistent( 'areOptionalPaymentMethodsEnabled' );
|
||||
const [ optionalMethods, setOptionalMethods ] = usePersistent(
|
||||
'areOptionalPaymentMethodsEnabled'
|
||||
);
|
||||
const [ products, setProducts ] = usePersistent( 'products' );
|
||||
|
||||
const savePersistent = async ( setter, value ) => {
|
||||
|
@ -70,9 +69,9 @@ const useHooks = () => {
|
|||
setManualClientSecret: ( value ) => {
|
||||
return savePersistent( setManualClientSecret, value );
|
||||
},
|
||||
areOptionalPaymentMethodsEnabled,
|
||||
setAreOptionalPaymentMethodsEnabled: ( value ) => {
|
||||
return savePersistent( setAreOptionalPaymentMethodsEnabled, value );
|
||||
optionalMethods,
|
||||
setOptionalMethods: ( value ) => {
|
||||
return savePersistent( setOptionalMethods, value );
|
||||
},
|
||||
products,
|
||||
setProducts: ( activeProducts ) => {
|
||||
|
@ -114,14 +113,11 @@ export const useProducts = () => {
|
|||
};
|
||||
|
||||
export const useOptionalPaymentMethods = () => {
|
||||
const {
|
||||
areOptionalPaymentMethodsEnabled,
|
||||
setAreOptionalPaymentMethodsEnabled,
|
||||
} = useHooks();
|
||||
const { optionalMethods, setOptionalMethods } = useHooks();
|
||||
|
||||
return {
|
||||
areOptionalPaymentMethodsEnabled,
|
||||
setAreOptionalPaymentMethodsEnabled,
|
||||
optionalMethods,
|
||||
setOptionalMethods,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue