blob: 1756095c8dda9fc65d117706d5b913d782e5ca57 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import {call, put, select} from "redux-saga/effects";
import {addToStore} from "../actions/objects";
import {addPrefab} from "../api/routes/prefabs";
import {getTopologyAsObject} from "./objects";
export function* onAddPrefab(action) {
try {
//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)
//TODO: yield call the function in saga to export the specific part of the topology
const prefab = yield call(addPrefab, { name: action.name, rack: currentRackJson })
yield put(addToStore('prefab', prefab))
} catch (error) {
console.error(error)
}
}
|