Skip to content

Commit

Permalink
Flux - 14 - Working with Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Jul 5, 2015
1 parent 136aa1f commit 10519ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions imgur-client/src/actions.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var Reflux = require('reflux');

module.exports = Reflux.createActions([
'getTopics'
]);
3 changes: 2 additions & 1 deletion imgur-client/src/components/topic-list.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var React = require('react');
var Reflux = require('reflux');
var TopicStore = require('../stores/topic-store');
var Actions = require('../actions');

module.exports = React.createClass({
mixins: [
Expand All @@ -12,7 +13,7 @@ module.exports = React.createClass({
}
},
componentWillMount: function() {
TopicStore.getTopics();
Actions.getTopics();
},
render: function() {
return <div className="list-group">
Expand Down
2 changes: 2 additions & 0 deletions imgur-client/src/stores/topic-store.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
var Api = require('../utils/api');
var Reflux = require('reflux');
var Actions = require('../actions');

module.exports = Reflux.createStore({
listenables: [Actions],
getTopics: function() {
return Api.get('topics/defaults')
.then(function(json){
Expand Down

0 comments on commit 10519ed

Please sign in to comment.