summaryrefslogtreecommitdiff
path: root/frontend/src/api/routes/projects.js
diff options
context:
space:
mode:
authorjc0b <j@jc0b.computer>2020-07-07 16:55:22 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:47:51 +0200
commit223e916997eb641a1662110b6de630a4cdfdf479 (patch)
tree90ca4364461f676db45f25e03d8f22fc32f9fdd8 /frontend/src/api/routes/projects.js
parent9ff1e3c6bae253372a468dbdc9b8369ab8dd2c6f (diff)
parentb810c4413079bf5aeb5374f1cd20e151a83530d0 (diff)
Merge branch 'feature/mongodb-migration' of github.com:atlarge-research/opendc-dev into feature/mongodb-migration
Diffstat (limited to 'frontend/src/api/routes/projects.js')
-rw-r--r--frontend/src/api/routes/projects.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/frontend/src/api/routes/projects.js b/frontend/src/api/routes/projects.js
new file mode 100644
index 00000000..a261adb8
--- /dev/null
+++ b/frontend/src/api/routes/projects.js
@@ -0,0 +1,56 @@
+import { sendRequest } from '../index'
+import { deleteById, getById } from './util'
+
+export function getProject(projectId) {
+ return getById('/projects/{projectId}', { projectId })
+}
+
+export function addProject(project) {
+ return sendRequest({
+ path: '/projects',
+ method: 'POST',
+ parameters: {
+ body: {
+ project,
+ },
+ path: {},
+ query: {},
+ },
+ })
+}
+
+export function updateProject(project) {
+ return sendRequest({
+ path: '/projects/{projectId}',
+ method: 'PUT',
+ parameters: {
+ body: {
+ project,
+ },
+ path: {
+ projectId: project._id,
+ },
+ query: {},
+ },
+ })
+}
+
+export function deleteProject(projectId) {
+ return deleteById('/projects/{projectId}', { projectId })
+}
+
+export function addExperiment(projectId, experiment) {
+ return sendRequest({
+ path: '/projects/{projectId}/experiments',
+ method: 'POST',
+ parameters: {
+ body: {
+ experiment,
+ },
+ path: {
+ projectId,
+ },
+ query: {},
+ },
+ })
+}