Skip to content

Instantly share code, notes, and snippets.

@toranb
Created April 4, 2016 00:13
Show Gist options
  • Save toranb/8bf0b62841051dc64f1fa81299526a0a to your computer and use it in GitHub Desktop.
Save toranb/8bf0b62841051dc64f1fa81299526a0a to your computer and use it in GitHub Desktop.
classic ember route with the redux service to dispatch with
import Ember from 'ember';
import ajax from 'example/utilities/ajax';
var UsersRoute = Ember.Route.extend({
redux: Ember.inject.service(),
model() {
var redux = this.get('redux');
return ajax('/api/users', 'GET').then(response => redux.dispatch({type: 'DESERIALIZE_USERS', response: response}));
}
});
export default UsersRoute;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment