index.js
27 lines
| 1 | import Button from '../button'; |
| 2 | import {logoutWithAPI, getCleanParentHref} from './utils'; |
| 3 | |
| 4 | import {__} from '@wordpress/i18n'; |
| 5 | import './style.scss'; |
| 6 | |
| 7 | const LogoutModal = ({onRequestClose}) => { |
| 8 | const handleLogout = async () => { |
| 9 | await logoutWithAPI(); |
| 10 | window.parent.location.href = getCleanParentHref(); |
| 11 | }; |
| 12 | |
| 13 | return ( |
| 14 | <> |
| 15 | <div className="give-donor-dashboard-logout-modal__buttons"> |
| 16 | <Button onClick={() => handleLogout()}>{__('Yes, logout', 'give')}</Button> |
| 17 | <a className="give-donor-dashboard-logout-modal__cancel" onClick={() => onRequestClose()}> |
| 18 | {__('Nevermind', 'give')} |
| 19 | </a> |
| 20 | </div> |
| 21 | <div className="give-donor-dashboard-logout-modal__bg" onClick={() => onRequestClose()} /> |
| 22 | </> |
| 23 | ); |
| 24 | }; |
| 25 | |
| 26 | export default LogoutModal; |
| 27 |