mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
✨ Add new “reset” flag to the JS-logic
This commit is contained in:
parent
921546953e
commit
da80defa93
2 changed files with 7 additions and 3 deletions
|
@ -19,9 +19,9 @@ const DisconnectButton = () => {
|
|||
}, [] );
|
||||
|
||||
const handleConfirm = useCallback( async () => {
|
||||
await disconnectMerchant();
|
||||
await disconnectMerchant( resetFlag );
|
||||
window.location.reload();
|
||||
}, [ disconnectMerchant ] );
|
||||
}, [ disconnectMerchant, resetFlag ] );
|
||||
|
||||
const confirmationTitle = __(
|
||||
'Disconnect from PayPal?',
|
||||
|
|
|
@ -153,13 +153,17 @@ export function authenticateWithOAuth( sharedId, authCode, useSandbox ) {
|
|||
/**
|
||||
* Side effect. Checks webhook simulation.
|
||||
*
|
||||
* @param {boolean} fullReset When true, all plugin settings are reset to initial values.
|
||||
* @return {Function} The thunk function.
|
||||
*/
|
||||
export function disconnectMerchant() {
|
||||
export function disconnectMerchant( fullReset = false ) {
|
||||
return async () => {
|
||||
return await apiFetch( {
|
||||
path: REST_DISCONNECT_MERCHANT_PATH,
|
||||
method: 'POST',
|
||||
data: {
|
||||
reset: fullReset,
|
||||
},
|
||||
} );
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue