ember-ajax

Fixes #37
Fixes #38
This commit is contained in:
Matthew Dillon 2015-11-12 13:32:41 -07:00
parent e54c6fcb2f
commit b12ff0eb20
7 changed files with 34 additions and 51 deletions

View file

@ -1,20 +1,17 @@
import Ember from 'ember';
import ajaxRequest from '../../../../utils/ajax-request';
const { Route, inject: { service } } = Ember;
export default Route.extend({
session: service(),
globals: service(),
ajax: service(),
model: function(params) {
const url = `${this.get('globals.apiURL')}/api/${this.get('globals.genus')}/users/verify/${params.nonce}`;
return ajaxRequest(url, {}, this.get('session'));
return this.get('ajax').request(`/users/verify/${params.nonce}`);
},
afterModel: function(model/*, transition*/) {
this.get('flashMessages').success(model.get('msg'));
this.get('flashMessages').success(model.msg);
this.transitionTo('login');
},