Skip to content

Instantly share code, notes, and snippets.

@isnifer
Created July 29, 2015 16:09
Show Gist options
  • Save isnifer/a8ccb6c515c9df680302 to your computer and use it in GitHub Desktop.
Save isnifer/a8ccb6c515c9df680302 to your computer and use it in GitHub Desktop.
import { Store } from 'flummox';
class MainPageStore extends Store {
constructor (flux) {
super(); // Don't forget this step
const MainPageActionIds = flux.getActionIds('MainPage');
this.register(MainPageActionIds.loadData, this.loadData);
this.register(MainPageActionIds.getTop, this.getTop);
this.state = {
giveaways: {},
top: [],
footer: {
users: 160125,
giveaways: 160287,
money: 1130247
}
};
}
loadData (payload) {
this.setState({giveaways: payload});
}
getTop (payload) {
this.setState({top: payload});
}
}
export default MainPageStore;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment