Skip to content

Instantly share code, notes, and snippets.

@Mariusio
Created March 9, 2016 17:16
Show Gist options
  • Save Mariusio/15cdca47281f7f03a028 to your computer and use it in GitHub Desktop.
Save Mariusio/15cdca47281f7f03a028 to your computer and use it in GitHub Desktop.
// app/routes/application.js
import Ember from 'ember';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
export default Ember.Route.extend(ApplicationRouteMixin, {
session: Ember.inject.service('session'),
authenticated: Ember.computed.oneWay('session.isAuthenticated'),
model() {
if (this.get('authenticated')) {
return Ember.RSVP.hash({
datasources: this.store.findAll('datasource')
});
}
},
setupController(controller, model) {
console.log("setupController of application.js called");
if (this.get('authenticated')) {
controller.set('datasources', model.datasources);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment