From f119fc78dda4d1e828dde04f378a63a93e3a0a7e Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 2 Jul 2020 18:39:28 +0200 Subject: Add current progress on frontend port --- frontend/src/api/routes/topologies.js | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 frontend/src/api/routes/topologies.js (limited to 'frontend/src/api/routes/topologies.js') diff --git a/frontend/src/api/routes/topologies.js b/frontend/src/api/routes/topologies.js new file mode 100644 index 00000000..307ea7ab --- /dev/null +++ b/frontend/src/api/routes/topologies.js @@ -0,0 +1,42 @@ +import { deleteById, getById } from './util' +import { sendRequest } from '../index' + +export function addTopology(topology) { + return sendRequest({ + path: '/simulations/{simulationId}/topologies', + method: 'POST', + parameters: { + body: { + topology, + }, + path: { + simulationId: topology.simulationId, + }, + query: {}, + }, + }) +} + +export function getTopology(topologyId) { + return getById('/topologies/{topologyId}', { topologyId }) +} + +export function updateTopology(topology) { + return sendRequest({ + path: '/topologies/{topologyId}', + method: 'PUT', + parameters: { + body: { + topology, + }, + path: { + topologyId: topology._id, + }, + query: {}, + }, + }) +} + +export function deleteTopology(topologyId) { + return deleteById('/topologies/{topologyId}', { topologyId }) +} -- cgit v1.2.3