summaryrefslogtreecommitdiff
path: root/frontend/src/containers/modals/NewTopologyModal.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/containers/modals/NewTopologyModal.js')
-rw-r--r--frontend/src/containers/modals/NewTopologyModal.js27
1 files changed, 10 insertions, 17 deletions
diff --git a/frontend/src/containers/modals/NewTopologyModal.js b/frontend/src/containers/modals/NewTopologyModal.js
index 282f0db9..0acf6cf2 100644
--- a/frontend/src/containers/modals/NewTopologyModal.js
+++ b/frontend/src/containers/modals/NewTopologyModal.js
@@ -3,11 +3,11 @@ import NewTopologyModalComponent from '../../components/modals/custom-components
import { closeNewTopologyModal } from '../../actions/modals/topology'
import { addTopology } from '../../actions/topologies'
-const mapStateToProps = state => {
- let topologies = state.objects.project[state.currentProjectId] ? state.objects.project[state.currentProjectId].topologyIds.map(t => (
- state.objects.topology[t]
- )) : []
- if (topologies.filter(t => !t).length > 0) {
+const mapStateToProps = (state) => {
+ let topologies = state.objects.project[state.currentProjectId]
+ ? state.objects.project[state.currentProjectId].topologyIds.map((t) => state.objects.topology[t])
+ : []
+ if (topologies.filter((t) => !t).length > 0) {
topologies = []
}
@@ -17,22 +17,17 @@ const mapStateToProps = state => {
}
}
-const mapDispatchToProps = dispatch => {
+const mapDispatchToProps = (dispatch) => {
return {
onCreateTopology: (name) => {
if (name) {
- dispatch(
- addTopology({ name, rooms: [] }),
- )
+ dispatch(addTopology(name, undefined))
}
dispatch(closeNewTopologyModal())
},
- onDuplicateTopology: (name) => {
+ onDuplicateTopology: (name, id) => {
if (name) {
- // TODO different handling here
- dispatch(
- addTopology({ name, rooms: [] }),
- )
+ dispatch(addTopology(name, id))
}
dispatch(closeNewTopologyModal())
},
@@ -42,8 +37,6 @@ const mapDispatchToProps = dispatch => {
}
}
-const NewTopologyModal = connect(mapStateToProps, mapDispatchToProps)(
- NewTopologyModalComponent,
-)
+const NewTopologyModal = connect(mapStateToProps, mapDispatchToProps)(NewTopologyModalComponent)
export default NewTopologyModal