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
Rolf Erik Sesseng Aas
tdt4242-base
Commits
3178869a
Commit
3178869a
authored
Apr 19, 2021
by
ibooking-sigurd
Browse files
Add two small refactorings.
parent
f921955d
Changes
2
Hide whitespace changes
Inline
Side-by-side
frontend/www/diets.html
View file @
3178869a
...
...
@@ -45,7 +45,7 @@
<h5
class=
"mb-1"
></h5>
</div>
<div
class=
"d-flex"
>
<table
class=
"mb-1 text-start"
>
<table
aria-label=
"diet-table"
class=
"mb-1 text-start"
>
<tr><th
id=
"date"
>
Date:
</th><td></td></tr>
<tr><th
id=
"time"
>
Time:
</th><td></td></tr>
<tr><th
id=
"owner"
>
Owner:
</th><td></td></tr>
...
...
frontend/www/scripts/myathletes.js
View file @
3178869a
...
...
@@ -5,8 +5,8 @@ async function displayCurrentRoster() {
let
currentUser
=
await
getCurrentUser
();
for
(
let
athleteUrl
of
currentUser
.
athletes
)
{
let
r
esponse
=
await
sendRequest
(
"
GET
"
,
athleteUrl
);
let
athlete
=
await
r
esponse
.
json
();
let
athleteR
esponse
=
await
sendRequest
(
"
GET
"
,
athleteUrl
);
let
athlete
=
await
athleteR
esponse
.
json
();
createFilledRow
(
templateFilledAthlete
,
athlete
.
username
,
controls
,
false
);
}
...
...
@@ -22,8 +22,8 @@ async function displayCurrentRoster() {
let
offers
=
await
response
.
json
();
for
(
let
offer
of
offers
.
results
)
{
let
response
=
await
sendRequest
(
"
GET
"
,
offer
.
recipient
);
let
recipient
=
await
response
.
json
();
let
res
ultRes
ponse
=
await
sendRequest
(
"
GET
"
,
offer
.
recipient
);
let
recipient
=
await
res
ultRes
ponse
.
json
();
createFilledRow
(
templateFilledAthlete
,
`
${
recipient
.
username
}
(pending)`
,
controls
,
true
);
}
}
...
...
@@ -302,9 +302,9 @@ async function submitRoster() {
body
.
athletes
.
push
(
athlete
.
id
);
}
else
{
// create offer
let
b
ody
=
{
'
status
'
:
'
p
'
,
'
recipient
'
:
athlete
.
url
};
let
r
esponse
=
await
sendRequest
(
"
POST
"
,
`
${
HOST
}
/api/offers/`
,
b
ody
);
if
(
!
r
esponse
.
ok
)
{
let
offerB
ody
=
{
'
status
'
:
'
p
'
,
'
recipient
'
:
athlete
.
url
};
let
offerR
esponse
=
await
sendRequest
(
"
POST
"
,
`
${
HOST
}
/api/offers/`
,
offerB
ody
);
if
(
!
offerR
esponse
.
ok
)
{
let
data
=
await
response
.
json
();
let
alert
=
createAlert
(
"
Could not create offer!
"
,
data
);
document
.
body
.
prepend
(
alert
);
...
...
Write
Preview
Supports
Markdown
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