- loadMore: function() {
- ajax(
- "/completedgames",
- "GET",
- {
- credentials: true,
- data: { cursor: this.cursor },
- success: (res) => {
- const L = res.games.length;
- if (L > 0) {
- this.cursor = res.games[L - 1].created;
- let moreGames = res.games;
- moreGames.forEach(g => g.type = "corr");
- this.decorate(moreGames);
- this.corrGames = this.corrGames.concat(moreGames);
- } else this.hasMore = false;
+ loadMore: function(type, cb) {
+ if (type == "corr" && this.st.user.id > 0) {
+ ajax(
+ "/completedgames",
+ "GET",
+ {
+ credentials: true,
+ data: { cursor: this.cursor["corr"] },
+ success: (res) => {
+ const L = res.games.length;
+ if (L > 0) {
+ this.cursor["corr"] = res.games[L - 1].created;
+ let moreGames = res.games;
+ moreGames.forEach(g => g.type = "corr");
+ this.decorate(moreGames);
+ this.corrGames = this.corrGames.concat(moreGames);
+ } else this.hasMore["corr"] = false;
+ if (!!cb) cb();
+ }