简体   繁体   中英

How to capture events of logout confirmation "Yes" and "No"

I am setting up events in my project and wanted help in capturing properties logout_confirmation 1) user click on ”Yes” 2) user click on “No”

const analytics = { track: (...args) => console.log('track: ', ...args) }


const logout = () => {
analytics.track('account_logged_out') // Can capture logout button event
Modal.confirm({
title: 'Are you sure you want to logout?',
icon: <ExclamationCircleOutlined />,
maskClosable: true,
cancelText: 'No',
cancelButtonProps: { size: 'large' },
okText: ' Yes ',
okButtonProps: { size: 'large' },
onOk() {
  localStorage.removeItem('auth')
  setUser(null)
  Router.push('/')
},
})

只需使用onOk()onClose()onCancel()

try like this:

Modal.confirm({
title: 'Are you sure you want to logout?',
icon: <ExclamationCircleOutlined />,
maskClosable: true,
cancelText: 'No',
cancelButtonProps: { size: 'large' },
okText: ' Yes ',
okButtonProps: { size: 'large' },
onOk() {
  localStorage.removeItem('auth')
  setUser(null)
  Router.push('/')
},
}).then(function(){}).catch(function(){});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM