MCPcopy Index your code
hub / github.com/codecombat/codecombat / onClickFreeSubLink

Method onClickFreeSubLink

app/views/admin/MainAdminView.js:269–290  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 4

isAdminMethod · 0.80
renderMethod · 0.45
errorMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected