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
2015-07-15 19:52:05 -08:00

32 lines
784 B
JavaScript

import Ember from 'ember';
import ajaxRequest from '../../../../utils/ajax-request';
export default Ember.Route.extend({
apiURL: function() {
return this.get('globals.apiURL');
}.property(),
genus: function() {
return this.get('globals.genus');
}.property(),
model: function(params) {
let url = `${this.get('apiURL')}/api/${this.get('genus')}/users/verify/${params.nonce}`;
return ajaxRequest(url);
},
afterModel: function(model/*, transition*/) {
this.get('flashMessages').success(model.msg);
this.transitionTo('login');
},
actions: {
error: function(error/*, transition*/) {
let err = Ember.$.parseJSON(error.responseText);
this.get('flashMessages').error(err.error);
this.transitionTo('login');
}
},
});