Skip to content

Commit

Permalink
fix$(Vue): Fix JSON parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
Qo2770 committed Jun 13, 2018
1 parent 407b852 commit f174872
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions client/src/components/ContestDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export default {
this.name = response.data.contestname;
this.code = response.data.contestcode;
this.date_end = response.data.date_end;
this.tasks = response.data.tasks;
this.tasks = typeof(response.data.tasks) == "array" ? response.data.tasks : [response.data.tasks];
console.log(this.tasks);
if(momentjs(new Date()).isSameOrAfter(this.date_end)) {
this.expired = true;
}
Expand Down Expand Up @@ -138,10 +139,10 @@ export default {
joinContest() {
axios.post('/api/contest.joined',
{
'user': localStorage.getItem('userid'),
'contest': this.code
});
{
'user': localStorage.getItem('userid'),
'contest': this.code
});
}
}
};
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/ContestsOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ export default {
// }
// );
axios.get("/api/contests?admin=" + localStorage.getItem('userid'))
.then(response => {
axios.get('/api/contests?admin=' + localStorage.getItem('userid'))
.then((response) => {
alert(typeof(this.contests_owned));
this.contests_owned = response.data;
}
);
);
},
methods: {
Expand Down

0 comments on commit f174872

Please sign in to comment.