nci/static/js/app/stores/projects.js
2015-10-16 01:13:10 +03:00

26 lines
564 B
JavaScript

'use strict';
define([
'reflux', 'app/actions/project', 'app/resources'
], function(Reflux, ProjectActions, resources) {
var resource = resources.projects;
var Store = Reflux.createStore({
listenables: ProjectActions,
onRun: function(projectName) {
resource.sync('run', {projectName: projectName}, function(err) {
if (err) throw err;
});
},
onReadAll: function(params) {
var self = this;
resource.sync('readAll', params, function(err, projects) {
if (err) throw err;
self.trigger(projects);
});
}
});
return Store;
});