diff options
| author | jc0b <j@jc0b.computer> | 2020-07-10 15:18:49 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:48:02 +0200 |
| commit | d8479e7e3744b8d1d31ac4d9f972e560eacd2cf8 (patch) | |
| tree | 79b7dfccec6e3cc1fce189b4605a37b354d676a2 /frontend/src/api/routes/scenarios.js | |
| parent | 4befa57993831274ad7e6ca62f96aa582f81cc5d (diff) | |
| parent | 3b4e27320c479bd6ef48998f448ed070e8bd7511 (diff) | |
Merge branch 'master' of github.com:atlarge-research/opendc-dev
Diffstat (limited to 'frontend/src/api/routes/scenarios.js')
| -rw-r--r-- | frontend/src/api/routes/scenarios.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/frontend/src/api/routes/scenarios.js b/frontend/src/api/routes/scenarios.js new file mode 100644 index 00000000..ab2e8b86 --- /dev/null +++ b/frontend/src/api/routes/scenarios.js @@ -0,0 +1,42 @@ +import { deleteById, getById } from './util' +import { sendRequest } from '../index' + +export function addScenario(portfolioId, scenario) { + return sendRequest({ + path: '/portfolios/{portfolioId}/scenarios', + method: 'POST', + parameters: { + body: { + scenario, + }, + path: { + portfolioId, + }, + query: {}, + }, + }) +} + +export function getScenario(scenarioId) { + return getById('/scenarios/{scenarioId}', { scenarioId }) +} + +export function updateScenario(scenarioId, scenario) { + return sendRequest({ + path: '/scenarios/{projectId}', + method: 'POST', + parameters: { + body: { + scenario, + }, + path: { + scenarioId, + }, + query: {}, + }, + }) +} + +export function deleteScenario(scenarioId) { + return deleteById('/scenarios/{scenarioId}', { scenarioId }) +} |
