nci/static/js/app/stores/project.js
Vladimir Polyakov 364943bfe0 reflux draft
2015-05-04 02:04:51 +03:00

25 lines
548 B
JavaScript

'use strict';
define([
'reflux', 'app/actions/project', 'app/resources'
], function(Reflux, ProjectActions, resources) {
var Store = Reflux.createStore({
init: function() {
this.listenTo(ProjectActions.load, this.load);
this.listenTo(ProjectActions.readAll, this.readAll);
},
load: function(items) {
this.trigger(items);
},
readAll: function() {
resources.projects.sync('read', function(err, projects) {
console.log(err);
console.log(projects);
ProjectActions.load(projects)
});
}
});
return Store;
});