Introduce action creators
These can be used to dispatch actions immediately, or after some asynchronous work has been done. Also, create GroupActions.fetchJoinedGroups as an example. The concept of async action creators can be used in the following cases: - stores or views that do async work, dispatching based on the results - actions that have complicated payloads, would make more sense as functions with documentation that dispatch created actions.
This commit is contained in:
parent
65d88334a9
commit
ee6df105fe
4 changed files with 64 additions and 16 deletions
|
@ -52,10 +52,10 @@ class TagOrderStore extends Store {
|
|||
this._setState({orderedTags});
|
||||
}
|
||||
break;
|
||||
// Initialise the state such that if account data is unset, default to the existing ordering
|
||||
case 'all_tags':
|
||||
// Initialise the state such that if account data is unset, default to joined groups
|
||||
case 'GroupActions.fetchJoinedGroups.success':
|
||||
this._setState({
|
||||
allTags: payload.tags.sort(), // Sort lexically
|
||||
allTags: payload.result.groups.sort(), // Sort lexically
|
||||
});
|
||||
break;
|
||||
// Puts payload.tag at payload.targetTag, placing the targetTag before or after the tag
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue