- watch: {
- // Watch event "user infos retrieved" (through /whoami)
- "st.user.id": function(newId) {
- if (newId > 0) //should always be the case
- {
- // Ask server for current corr games (all but mines)
- // ajax(
- // "/games",
- // "GET",
- // {excluded: this.st.user.id},
- // response => {
- // this.games = this.games.concat(response.games);
- // }
- // );
- // Also ask for corr challenges (open + sent to me)
- ajax(
- "/challenges",
- "GET",
- {uid: this.st.user.id},
- response => {
- console.log(response.challenges);
- // TODO: post-treatment on challenges ?
- this.challenges = this.challenges.concat(response.challenges);
- }
- );
- }
- },
- },