mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +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 { CommonHooks } from '../../../../../../data';
|
||||||
import { useToggleState } from '../../../../../../hooks/useToggleState';
|
import { useToggleState } from '../../../../../../hooks/useToggleState';
|
||||||
import { HStack } from '../../../../../ReusableComponents/Stack';
|
import { HStack } from '../../../../../ReusableComponents/Stack';
|
||||||
|
import { useNavigation } from '../../../../../../hooks/useNavigation';
|
||||||
|
|
||||||
const DisconnectButton = () => {
|
const DisconnectButton = () => {
|
||||||
const { isOpen, setIsOpen } = useToggleState( 'disconnect-merchant' );
|
const { isOpen, setIsOpen } = useToggleState( 'disconnect-merchant' );
|
||||||
const [ resetFlag, setResetFlag ] = useState( false );
|
const [ resetFlag, setResetFlag ] = useState( false );
|
||||||
const { disconnectMerchant } = CommonHooks.useDisconnectMerchant();
|
const { disconnectMerchant } = CommonHooks.useDisconnectMerchant();
|
||||||
|
const { goToPluginSettings } = useNavigation();
|
||||||
|
|
||||||
const handleOpen = useCallback( () => {
|
const handleOpen = useCallback( () => {
|
||||||
setIsOpen( true );
|
setIsOpen( true );
|
||||||
}, [] );
|
}, [ setIsOpen ] );
|
||||||
|
|
||||||
const handleCancel = useCallback( () => {
|
const handleCancel = useCallback( () => {
|
||||||
setIsOpen( false );
|
setIsOpen( false );
|
||||||
}, [] );
|
}, [ setIsOpen ] );
|
||||||
|
|
||||||
const handleConfirm = useCallback( async () => {
|
const handleConfirm = useCallback( async () => {
|
||||||
await disconnectMerchant( resetFlag );
|
await disconnectMerchant( resetFlag );
|
||||||
window.location.reload();
|
goToPluginSettings();
|
||||||
}, [ disconnectMerchant, resetFlag ] );
|
}, [ disconnectMerchant, resetFlag ] );
|
||||||
|
|
||||||
const confirmationTitle = __(
|
const confirmationTitle = __(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue