mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
36 lines
827 B
JavaScript
36 lines
827 B
JavaScript
import { useCallback } from '@wordpress/element';
|
|
|
|
import {
|
|
CommonHooks,
|
|
PaymentHooks,
|
|
SettingsHooks,
|
|
StylingHooks,
|
|
} from '../data';
|
|
|
|
export const useSaveSettings = () => {
|
|
const { withActivity } = CommonHooks.useBusyState();
|
|
|
|
const { persist: persistPayment } = PaymentHooks.useStore();
|
|
const { persist: persistSettings } = SettingsHooks.useStore();
|
|
const { persist: persistStyling } = StylingHooks.useStore();
|
|
|
|
const persistAll = useCallback( () => {
|
|
withActivity(
|
|
'persist-methods',
|
|
'Save payment methods',
|
|
persistPayment
|
|
);
|
|
withActivity(
|
|
'persist-settings',
|
|
'Save the settings',
|
|
persistSettings
|
|
);
|
|
withActivity(
|
|
'persist-styling',
|
|
'Save styling details',
|
|
persistStyling
|
|
);
|
|
}, [ persistPayment, persistSettings, persistStyling, withActivity ] );
|
|
|
|
return { persistAll };
|
|
};
|