mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-12 09:25:08 +00:00
25 lines
548 B
JavaScript
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;
|
||
|
});
|