(e)
| 415 | } |
| 416 | |
| 417 | onNextGamePressed (e) { |
| 418 | return this.fetchRandomSessionPair((err, data) => { |
| 419 | const leagueID = utils.getQueryVariable('league') |
| 420 | if (this.destroyed) { return } |
| 421 | if (err) { return console.log(`There was an error fetching the random session pair: ${data}`) } |
| 422 | this.setSessions(data[0]._id, data[1]._id) |
| 423 | let url = `/play/spectate/${this.levelID}?session-one=${this.sessionOne}&session-two=${this.sessionTwo}` |
| 424 | if (leagueID) { |
| 425 | url += '&league=' + leagueID |
| 426 | } |
| 427 | Backbone.Mediator.publish('router:navigate', { |
| 428 | route: url, |
| 429 | viewClass: SpectateLevelView, |
| 430 | viewArgs: [ |
| 431 | { |
| 432 | spectateSessions: { sessionOne: this.sessionOne, sessionTwo: this.sessionTwo }, |
| 433 | supermodel: this.supermodel |
| 434 | }, |
| 435 | this.levelID |
| 436 | ] |
| 437 | }) |
| 438 | return __guardMethod__(history, 'pushState', o => o.pushState({}, '', url)) |
| 439 | }) // Backbone won't update the URL if just query parameters change |
| 440 | } |
| 441 | |
| 442 | fetchRandomSessionPair (cb) { |
| 443 | const leagueID = utils.getQueryVariable('league') |
nothing calls this directly
no test coverage detected