mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
♻️ After logout navigate to clean settings URL
This commit is contained in:
parent
5472ca580f
commit
3e5e997f04
1 changed files with 5 additions and 3 deletions
|
@ -5,23 +5,25 @@ import { useCallback, useState } from '@wordpress/element';
|
|||
import { CommonHooks } from '../../../../../../data';
|
||||
import { useToggleState } from '../../../../../../hooks/useToggleState';
|
||||
import { HStack } from '../../../../../ReusableComponents/Stack';
|
||||
import { useNavigation } from '../../../../../../hooks/useNavigation';
|
||||
|
||||
const DisconnectButton = () => {
|
||||
const { isOpen, setIsOpen } = useToggleState( 'disconnect-merchant' );
|
||||
const [ resetFlag, setResetFlag ] = useState( false );
|
||||
const { disconnectMerchant } = CommonHooks.useDisconnectMerchant();
|
||||
const { goToPluginSettings } = useNavigation();
|
||||
|
||||
const handleOpen = useCallback( () => {
|
||||
setIsOpen( true );
|
||||
}, [] );
|
||||
}, [ setIsOpen ] );
|
||||
|
||||
const handleCancel = useCallback( () => {
|
||||
setIsOpen( false );
|
||||
}, [] );
|
||||
}, [ setIsOpen ] );
|
||||
|
||||
const handleConfirm = useCallback( async () => {
|
||||
await disconnectMerchant( resetFlag );
|
||||
window.location.reload();
|
||||
goToPluginSettings();
|
||||
}, [ disconnectMerchant, resetFlag ] );
|
||||
|
||||
const confirmationTitle = __(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue