Created
November 4, 2015 03:14
-
-
Save hedgerh/50d13aea099e8f8a2117 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] } | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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