diff --git a/imgur-client/src/components/image-detail.jsx b/imgur-client/src/components/image-detail.jsx
index 8e066fb..39146a4 100644
--- a/imgur-client/src/components/image-detail.jsx
+++ b/imgur-client/src/components/image-detail.jsx
@@ -1,9 +1,19 @@
var React = require('react');
+var Reflux = require('reflux');
+var ImageStore = require('../stores/image-store');
module.exports = React.createClass({
+ mixins: [
+ Reflux.listenTo(ImageStore, 'onChange')
+ ],
render: function() {
return
I am an image detail.
+ },
+ onChange: function(event, image) {
+ this.setState({
+ image: image
+ });
}
});
diff --git a/imgur-client/src/stores/image-store.jsx b/imgur-client/src/stores/image-store.jsx
index 1e5c4a9..961bd11 100644
--- a/imgur-client/src/stores/image-store.jsx
+++ b/imgur-client/src/stores/image-store.jsx
@@ -15,6 +15,16 @@ module.exports = Reflux.createStore({
this.triggerChange();
}.bind(this));
},
+ find: function(id){
+ var image = _.findWhere(this.images, {id: id});
+
+ if(image) {
+ return image
+ } else {
+ this.getImage(id);
+ return null
+ }
+ },
triggerChange: function() {
this.trigger('change', this.images);
}