|
@@ -1,15 +1,13 @@
|
|
|
export default {
|
|
export default {
|
|
|
rendered: false,
|
|
rendered: false,
|
|
|
- workout: null,
|
|
|
|
|
|
|
|
|
|
render: function(workout){
|
|
render: function(workout){
|
|
|
- this.workout = workout;
|
|
|
|
|
-
|
|
|
|
|
if(!this.rendered){
|
|
if(!this.rendered){
|
|
|
- this.buttons();
|
|
|
|
|
|
|
+ this.buttons(workout);
|
|
|
this.rendered = true;
|
|
this.rendered = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ document.getElementById("sessionHistoryTitle").textContent = workout.name;
|
|
|
this.populateSessions(workout);
|
|
this.populateSessions(workout);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -20,7 +18,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
populateSessions: function(workout){
|
|
populateSessions: function(workout){
|
|
|
- fetch(`/session/${this.workout.id}/all`, {
|
|
|
|
|
|
|
+ fetch(`/session/${workout.id}/all`, {
|
|
|
method: "GET",
|
|
method: "GET",
|
|
|
headers: {
|
|
headers: {
|
|
|
"Content-Type": "application/json"
|
|
"Content-Type": "application/json"
|
|
@@ -43,6 +41,10 @@ export default {
|
|
|
showSessions: function(sessions){
|
|
showSessions: function(sessions){
|
|
|
const container = document.getElementById("sessionHistoryItems");
|
|
const container = document.getElementById("sessionHistoryItems");
|
|
|
|
|
|
|
|
|
|
+ while(container.children.length > 0){
|
|
|
|
|
+ container.removeChild(container.firstChild);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
for(let i = 0; i < sessions.length; i++){
|
|
for(let i = 0; i < sessions.length; i++){
|
|
|
container.appendChild(this.createSessionButton(sessions[i]));
|
|
container.appendChild(this.createSessionButton(sessions[i]));
|
|
|
}
|
|
}
|