Update assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-card.js

Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
This commit is contained in:
Alex Florisca 2022-08-23 11:06:50 +01:00
parent 53650ff6ba
commit 4ac0806990
1 changed files with 6 additions and 7 deletions

View File

@ -28,19 +28,18 @@ import PaymentMethodErrorBoundary from './payment-method-error-boundary';
*/
const PaymentMethodCard = ( { children, showSaveOption } ) => {
const { isEditor } = useEditorContext();
const { shouldSavePaymentMethod } = useSelect( ( select ) => {
const store = select( PAYMENT_METHOD_DATA_STORE_KEY );
const { shouldSavePaymentMethod, customerId } = useSelect( ( select ) => {
const paymentMethodStore = select( PAYMENT_METHOD_DATA_STORE_KEY );
const checkoutStore = select( CHECKOUT_STORE_KEY );
return {
shouldSavePaymentMethod: store.shouldSavePaymentMethod(),
shouldSavePaymentMethod:
paymentMethodStore.shouldSavePaymentMethod(),
customerId: checkoutStore.getCustomerId(),
};
} );
const { setShouldSavePaymentMethod } = useDispatch(
PAYMENT_METHOD_DATA_STORE_KEY
);
const customerId = useSelect( ( select ) =>
select( CHECKOUT_STORE_KEY ).getCustomerId()
);
return (
<PaymentMethodErrorBoundary isEditor={ isEditor }>
{ children }