blob: e7c4014d6547de3d449090cfb53ff38fc322294c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import React from 'react'
import { connect } from 'react-redux'
import { closeDeleteProfileModal } from '../../actions/modals/profile'
import { deleteCurrentUser } from '../../actions/users'
import ConfirmationModal from '../../components/modals/ConfirmationModal'
const DeleteProfileModalComponent = ({ visible, callback }) => (
<ConfirmationModal
title="Delete my account"
message="Are you sure you want to delete your OpenDC account?"
show={visible}
callback={callback}
/>
)
const mapStateToProps = (state) => {
return {
visible: state.modals.deleteProfileModalVisible,
}
}
const mapDispatchToProps = (dispatch) => {
return {
callback: (isConfirmed) => {
if (isConfirmed) {
dispatch(deleteCurrentUser())
}
dispatch(closeDeleteProfileModal())
},
}
}
const DeleteProfileModal = connect(mapStateToProps, mapDispatchToProps)(DeleteProfileModalComponent)
export default DeleteProfileModal
|