X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=fb3ed63030d33e2b04ce4c0dddc5b34721bc7d8c;hp=c47e89f109d1a8c57044d9799cfdebe56dcbd44c;hb=bebcc8d45532e67902175f69084a08040f06855f;hpb=6e3a7e26d57f60480b08abed7441963674a79b18 diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index c47e89f1..fb3ed630 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -143,9 +143,24 @@ export default { "GET", {uid: this.st.user.id}, response => { - console.log(response.challenges); - // TODO: post-treatment on challenges ? - Array.prototype.push.apply(this.challenges, response.challenges); + // Gather all senders names, and then retrieve full identity: + // (TODO [perf]: some might be online...) + const uids = response.challenges.map(c => { return c.uid }); + ajax("/users", + "GET", + { ids: uids }, + names => { + this.challenges = this.challenges.concat( + response.challenges.map(c => { + // (just players names in fact) + const from = {name: names[c.uid], id: c.uid}; + const type = this.classifyObject(c); + const vname = this.getVname(c.vid); + return Object.assign({}, c, {type: type, vname: vname, from: from}); + }) + ) + } + ); } ); } @@ -443,7 +458,7 @@ export default { ajax( "/challenges", "POST", - chall, + { chall: chall }, response => { finishAddChallenge(response.cid); } ); }