Refactor to allow dispatching of two kinds of Actions
They are: 1. The existing type of Action, Objects with an `action` type. 1. Asyncronous Actions, functions that accept a `dispatch` argument, which can be used to dispatch Actions asyncronously.
This commit is contained in:
parent
60d8ebb914
commit
13925db251
5 changed files with 37 additions and 31 deletions
|
@ -14,13 +14,12 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { createPromiseActionCreator } from './actionCreators';
|
||||
import { asyncAction } from './actionCreators';
|
||||
|
||||
const GroupActions = {};
|
||||
|
||||
GroupActions.fetchJoinedGroups = createPromiseActionCreator(
|
||||
'GroupActions.fetchJoinedGroups',
|
||||
(matrixClient) => matrixClient.getJoinedGroups(),
|
||||
);
|
||||
GroupActions.fetchJoinedGroups = function(matrixClient) {
|
||||
return asyncAction('GroupActions.fetchJoinedGroups', () => matrixClient.getJoinedGroups());
|
||||
};
|
||||
|
||||
export default GroupActions;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue