| 267 | } |
| 268 | |
| 269 | onClickFreeSubLink (e) { |
| 270 | delete this.freeSubLink |
| 271 | if (!me.isAdmin()) { return } |
| 272 | const options = { |
| 273 | url: '/db/prepaid/-/create', |
| 274 | data: { type: 'subscription', maxRedeemers: 1 }, |
| 275 | method: 'POST' |
| 276 | } |
| 277 | options.success = (model, response, options) => { |
| 278 | // TODO: Don't hardcode domain. |
| 279 | if (application.isProduction()) { |
| 280 | this.freeSubLink = `https://codecombat.com/account/subscription?_ppc=${model.code}` |
| 281 | } else { |
| 282 | this.freeSubLink = `http://localhost:3000/account/subscription?_ppc=${model.code}` |
| 283 | } |
| 284 | return (typeof this.render === 'function' ? this.render() : undefined) |
| 285 | } |
| 286 | options.error = (model, response, options) => { |
| 287 | return console.error('Failed to create prepaid', response) |
| 288 | } |
| 289 | return this.supermodel.addRequestResource('create_prepaid', options, 0).load() |
| 290 | } |
| 291 | |
| 292 | onClickToggleAdminAvailability (e) { |
| 293 | if (this.parentAdminUpdateInProgress) { |