confirm.js 586 B

12345678910111213141516171819202122232425
  1. import MisagoRoute from 'misago/routes/misago';
  2. export default MisagoRoute.extend({
  3. model: function(params) {
  4. return this.ajax.post('users/' + this.get('auth.user.id') + '/change-email', {
  5. 'token': params.token
  6. });
  7. },
  8. afterModel: function(model) {
  9. this.toast.success(model.detail);
  10. return this.transitionTo('options.email');
  11. },
  12. actions: {
  13. error: function(reason) {
  14. if (reason.status === 400) {
  15. this.toast.error(reason.responseJSON.detail);
  16. return this.transitionTo('options.email');
  17. }
  18. return true;
  19. }
  20. }
  21. });