summaryrefslogtreecommitdiff
path: root/frontend/src/sagas/prefabs.js
diff options
context:
space:
mode:
authorjc0b <j@jc0b.computer>2020-07-29 17:31:31 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:48:46 +0200
commitb817af6802c1168f17f87308aa922bee5f629a24 (patch)
treeecc1f3128ceef7cc54ebc09fbcc515b9cb7e584e /frontend/src/sagas/prefabs.js
parent0a984529480c08aaf6af9f6f657d4ed805e77d49 (diff)
Adding prefabs works now
Diffstat (limited to 'frontend/src/sagas/prefabs.js')
-rw-r--r--frontend/src/sagas/prefabs.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/frontend/src/sagas/prefabs.js b/frontend/src/sagas/prefabs.js
index 93af105a..1c21215a 100644
--- a/frontend/src/sagas/prefabs.js
+++ b/frontend/src/sagas/prefabs.js
@@ -1,14 +1,17 @@
import {call, put, select} from "redux-saga/effects";
import {addToStore} from "../actions/objects";
import {addPrefab} from "../api/routes/prefabs";
-import {getTopologyAsObject} from "./objects";
+import {getRackById, getTopologyAsObject} from "./objects";
export function* onAddPrefab(action) {
try {
- const state = yield select((state) => state)
- console.log("DEBUG: " + state.objects.tile[state.interactionLevel.tileId].rack._id)
- const currentRackId = yield select((state) => state.objects.tile[state.interactionLevel.tileId].rack._id)
- const currentRackJson = yield call(getTopologyAsObject, currentRackId)
+ // const state = yield select((state) => state)
+ // console.log("DEBUG: tileId = " + state.interactionLevel.tileId)
+ // console.log(state.objects.tile[state.interactionLevel.tileId])
+ // console.log("DEBUG: " + state.objects.tile[state.interactionLevel.tileId].rackId)
+ const currentRackId = yield select((state) => state.objects.tile[state.interactionLevel.tileId].rackId)
+ console.log("DEBUG: currentRackId = " + currentRackId)
+ const currentRackJson = yield getRackById(currentRackId, false)
const prefab = yield call(addPrefab, { name: action.name, rack: currentRackJson })
yield put(addToStore('prefab', prefab))