Skip to content

Instantly share code, notes, and snippets.

@hedgerh
Created November 4, 2015 03:14
Show Gist options
  • Save hedgerh/50d13aea099e8f8a2117 to your computer and use it in GitHub Desktop.
Save hedgerh/50d13aea099e8f8a2117 to your computer and use it in GitHub Desktop.
import Reflux from 'reflux';
/**
* Define all async actions for blog store.
* Using 'failure' because Reflux acts weird when using 'failed'.
*/
export default Reflux.createActions({
"addPost": { children: ["completed", "failure"] },
"deletePost": { children: ["completed", "failure"] },
"getPosts": { children: ["completed", "failure"] }
});
import Reflux from 'reflux';
import request from 'superagent';
import BlogActions from '../actions/blog';
export default Reflux.createStore({
listenables: [
BlogActions
],
init() {
// Initialize the object that will hold our data.
this.data = {
user: {
username: 'Joe Smith',
},
newPost: {
title: '',
content: ''
}
};
},
/**
* When a component connects to this store,
* it gets this as its initial state.
* @return {object} Data stored in our store.
*/
getInitialState() {
return this.data;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment