Inject session for vanilla ajax requests
This commit is contained in:
parent
bbcef5459e
commit
f06fbd0305
5 changed files with 17 additions and 5 deletions
|
@ -2,6 +2,8 @@ import Ember from 'ember';
|
|||
import ajaxRequest from '../../../../utils/ajax-request';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
|
||||
queryParams: {
|
||||
strain_ids: {
|
||||
refreshModel: true,
|
||||
|
@ -33,7 +35,7 @@ export default Ember.Route.extend({
|
|||
method: 'GET',
|
||||
data: params,
|
||||
};
|
||||
return ajaxRequest(url, options);
|
||||
return ajaxRequest(url, options, this.get('session'));
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
|
|
|
@ -2,6 +2,7 @@ import Ember from 'ember';
|
|||
import ajaxRequest from '../../../../utils/ajax-request';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
currentUser: Ember.inject.service('session-account'),
|
||||
|
||||
passwordConfirm: null,
|
||||
|
@ -22,7 +23,7 @@ export default Ember.Controller.extend({
|
|||
password: this.get('password'),
|
||||
},
|
||||
};
|
||||
ajaxRequest(url, options);
|
||||
ajaxRequest(url, options, this.get('session'));
|
||||
this.transitionTo('protected.users.index');
|
||||
this.get('flashMessages').information('Your password has been changed.');
|
||||
},
|
||||
|
|
Reference in a new issue