Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ITPDP2019
Gain.fam
web-server
Commits
75923eee
Commit
75923eee
authored
May 14, 2019
by
Magnus Holm Brunbjerg
Browse files
No nameless experiments
parent
e0d75dd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/app/index.js
View file @
75923eee
...
...
@@ -114,8 +114,7 @@ app.route('/experiments')
const
experimentContent
=
{
user_id
:
req
.
body
.
userId
,
name
:
req
.
body
.
name
,
start_time
:
new
Date
(),
end_time
:
new
Date
()
time
:
new
Date
()
}
// Create new experiment
fetch
(
`
${
api
}
/experiments`
,
{
...
...
@@ -127,14 +126,18 @@ app.route('/experiments')
if
(
response
.
status
===
200
)
{
return
response
.
json
()
}
}).
then
((
experiment
)
=>
{
if
(
experiment
)
{
fetch
(
`
${
api
}
/experiments/
${
experiment
.
id
}
`
,
{
method
:
'
POST
'
,
mode
:
'
cors
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
body
:
JSON
.
stringify
(
experimentContent
)
}).
then
(()
=>
{
if
(
req
.
body
.
name
)
{
fetch
(
`
${
api
}
/experiments/
${
experiment
.
id
}
`
,
{
method
:
'
POST
'
,
mode
:
'
cors
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
body
:
JSON
.
stringify
(
experimentContent
)
}).
then
(()
=>
{
res
.
redirect
(
'
/
'
)
})
}
else
{
res
.
redirect
(
'
/
'
)
}
)
}
}
else
{
res
.
redirect
(
'
/
'
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment