index.js
34 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 | <div className="give-donor-dashboard-logout-modal"> |
| 15 | <div className="give-donor-dashboard-logout-modal__frame"> |
| 16 | <div className="give-donor-dashboard-logout-modal__header"> |
| 17 | {__('Are you sure you want to logout?', 'give')} |
| 18 | </div> |
| 19 | <div className="give-donor-dashboard-logout-modal__body"> |
| 20 | <div className="give-donor-dashboard-logout-modal__buttons"> |
| 21 | <Button onClick={() => handleLogout()}>{__('Yes, logout', 'give')}</Button> |
| 22 | <a className="give-donor-dashboard-logout-modal__cancel" onClick={() => onRequestClose()}> |
| 23 | {__('Nevermind', 'give')} |
| 24 | </a> |
| 25 | </div> |
| 26 | </div> |
| 27 | </div> |
| 28 | <div className="give-donor-dashboard-logout-modal__bg" onClick={() => onRequestClose()} /> |
| 29 | </div> |
| 30 | ); |
| 31 | }; |
| 32 | |
| 33 | export default LogoutModal; |
| 34 |