I have an EmberJS app, where for one of my controllers I'm getting an error Assertion Failed: Attempting to inject an unknown injection: 'service:session'
I'm using a session service that utilizes the library ember-simple-auth. I have used the session service so I know that it works, but I am still getting this error? Does it have anything to do with any of the node ember modules being updated ?
Controller
import Controller from '@ember/controller';
import { get, set } from '@ember/object';
import $ from 'jquery';
import config from '../../../config/environment';
import { inject as service } from '@ember/service';
export default Controller.extend({
session: service('session'),
actions: {
merge(preserve) {
let ExpList = [];
// To-Do Make this a computed property
get(this, 'model.experiences').forEach(function(exp) {
ExpList.pushObject(exp.id);
});
this.get('session').authorize('authorizer:django', (authKey, authToken) => {
$.ajax({
url: `${config.APP.API_HOST}/api/v0.1/`,
type: 'POST',
headers: {
'Authorization': authToken
},
data: {
'experience_ids': ExpList,
'name': get(this, 'model.newExp.name'),
preserve,
'module': get(this, 'moduleExp')
}
}).then(() => {
this.transitionToRoute('route');
}).catch(function(error) {
this.set('errorMessage', error.error || error);
});
});
}
}
});
Aucun commentaire:
Enregistrer un commentaire