This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
hymenobacterdotinfo/app/pods/users/new/verify/route.js
Matthew Dillon b12ff0eb20 ember-ajax
Fixes #37
Fixes #38
2015-11-12 13:32:41 -07:00

26 lines
602 B
JavaScript

import Ember from 'ember';
const { Route, inject: { service } } = Ember;
export default Route.extend({
session: service(),
ajax: service(),
model: function(params) {
return this.get('ajax').request(`/users/verify/${params.nonce}`);
},
afterModel: function(model/*, transition*/) {
this.get('flashMessages').success(model.msg);
this.transitionTo('login');
},
actions: {
error: function(error/*, transition*/) {
const err = Ember.$.parseJSON(error.responseText);
this.get('flashMessages').error(err.error);
this.transitionTo('login');
}
},
});