summaryrefslogtreecommitdiff
path: root/src/containers
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-08-19 15:39:58 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:05:43 +0200
commit19033b8460cb43dc2fa34a2cffa932b5efe111ca (patch)
tree79bde2093acce8d8192d27e288d61bc53cf99e07 /src/containers
parent434be6d21ad665cb6abdf5138d0c563efbfe00b4 (diff)
Add profile page
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/profile/DeleteProfileModal.js36
-rw-r--r--src/containers/simulations/NewSimulationModal.js2
2 files changed, 37 insertions, 1 deletions
diff --git a/src/containers/profile/DeleteProfileModal.js b/src/containers/profile/DeleteProfileModal.js
new file mode 100644
index 00000000..b59db055
--- /dev/null
+++ b/src/containers/profile/DeleteProfileModal.js
@@ -0,0 +1,36 @@
+import React from "react";
+import {connect} from "react-redux";
+import {closeDeleteProfileModal} from "../../actions/profile";
+import {deleteCurrentUser} from "../../actions/users";
+import ConfirmationModal from "../../components/modals/ConfirmationModal";
+
+const NewSimulationModalComponent = ({visible, callback}) => (
+ <ConfirmationModal title="Delete my account"
+ message="Are you sure you want do 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 NewSimulationModal = connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(NewSimulationModalComponent);
+
+export default NewSimulationModal;
diff --git a/src/containers/simulations/NewSimulationModal.js b/src/containers/simulations/NewSimulationModal.js
index a4a3d2a8..cb858fed 100644
--- a/src/containers/simulations/NewSimulationModal.js
+++ b/src/containers/simulations/NewSimulationModal.js
@@ -11,7 +11,7 @@ const NewSimulationModalComponent = ({visible, callback}) => (
const mapStateToProps = state => {
return {
- visible: state.newSimulationModalVisible
+ visible: state.modals.newSimulationModalVisible
};
};