mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +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 () => {
|
const handleConfirm = useCallback( async () => {
|
||||||
await disconnectMerchant();
|
await disconnectMerchant( resetFlag );
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, [ disconnectMerchant ] );
|
}, [ disconnectMerchant, resetFlag ] );
|
||||||
|
|
||||||
const confirmationTitle = __(
|
const confirmationTitle = __(
|
||||||
'Disconnect from PayPal?',
|
'Disconnect from PayPal?',
|
||||||
|
|
|
@ -153,13 +153,17 @@ export function authenticateWithOAuth( sharedId, authCode, useSandbox ) {
|
||||||
/**
|
/**
|
||||||
* Side effect. Checks webhook simulation.
|
* Side effect. Checks webhook simulation.
|
||||||
*
|
*
|
||||||
|
* @param {boolean} fullReset When true, all plugin settings are reset to initial values.
|
||||||
* @return {Function} The thunk function.
|
* @return {Function} The thunk function.
|
||||||
*/
|
*/
|
||||||
export function disconnectMerchant() {
|
export function disconnectMerchant( fullReset = false ) {
|
||||||
return async () => {
|
return async () => {
|
||||||
return await apiFetch( {
|
return await apiFetch( {
|
||||||
path: REST_DISCONNECT_MERCHANT_PATH,
|
path: REST_DISCONNECT_MERCHANT_PATH,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
reset: fullReset,
|
||||||
|
},
|
||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue