(options, userID, verificationCode)
| 25 | } |
| 26 | |
| 27 | constructor (options, userID, verificationCode) { |
| 28 | super(options) |
| 29 | this.userID = userID |
| 30 | this.verificationCode = verificationCode |
| 31 | this.noDeleteInactiveEU = utils.getQueryVariable('no_delete_inactive_eu', false) |
| 32 | this.keepMeUpdated = utils.getQueryVariable('keep_me_updated', false) |
| 33 | this.promptKeepMeUpdated = utils.getQueryVariable('prompt_keep_me_updated', false) |
| 34 | |
| 35 | this.state = new State({ status: 'loading' }) |
| 36 | this.user = new User({ _id: this.userID }) |
| 37 | |
| 38 | if (this.noDeleteInactiveEU) { this.user.sendNoDeleteEUVerificationCode(this.verificationCode) } |
| 39 | if (this.keepMeUpdated) { this.user.sendKeepMeUpdatedVerificationCode(this.verificationCode) } |
| 40 | if (!this.keepMeUpdated && !this.noDeleteInactiveEU) { this.state.set({ status: 'done loading' }) } |
| 41 | |
| 42 | this.listenTo(this.state, 'change', this.render) |
| 43 | this.listenTo(this.user, 'user-keep-me-updated-success', () => { |
| 44 | this.state.set({ keepMeUpdatedSuccess: true }) |
| 45 | this.state.set({ status: 'done loading' }) |
| 46 | return me.fetch() |
| 47 | }) |
| 48 | this.listenTo(this.user, 'user-keep-me-updated-error', () => { |
| 49 | this.state.set({ keepMeUpdatedError: true }) |
| 50 | return this.state.set({ status: 'done loading' }) |
| 51 | }) |
| 52 | this.listenTo(this.user, 'user-no-delete-eu-success', () => { |
| 53 | this.state.set({ noDeleteEUSuccess: true }) |
| 54 | this.state.set({ status: 'done loading' }) |
| 55 | return me.fetch() |
| 56 | }) |
| 57 | this.listenTo(this.user, 'user-no-delete-eu-error', () => { |
| 58 | this.state.set({ status: 'done loading' }) |
| 59 | return this.state.set({ noDeleteEUError: true }) |
| 60 | }) |
| 61 | } |
| 62 | |
| 63 | onClickKeepMeUpdated (e) { |
| 64 | return this.user.sendKeepMeUpdatedVerificationCode(this.verificationCode) |
nothing calls this directly
no test coverage detected