nci/static/js/app/stores/projects.js

26 lines
564 B
JavaScript
Raw Normal View History

2015-07-09 20:12:24 +00:00
'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) {
2015-10-15 22:13:10 +00:00
resource.sync('run', {projectName: projectName}, function(err) {
if (err) throw err;
2015-07-09 20:12:24 +00:00
});
},
2015-10-15 22:13:10 +00:00
onReadAll: function(params) {
2015-07-09 20:12:24 +00:00
var self = this;
2015-10-15 22:13:10 +00:00
resource.sync('readAll', params, function(err, projects) {
2015-07-09 20:12:24 +00:00
if (err) throw err;
self.trigger(projects);
});
}
});
return Store;
});