X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9e4b7889a99ff2f76d8029aef3a85c4620178ba3..09c61f87d52388ebfe97f478d536f4f194755401:/src/store/collection/collection-action.ts diff --git a/src/store/collection/collection-action.ts b/src/store/collection/collection-action.ts index 5f1d60f3..f50e6458 100644 --- a/src/store/collection/collection-action.ts +++ b/src/store/collection/collection-action.ts @@ -4,6 +4,8 @@ import { Collection } from "../../models/collection"; import { default as unionize, ofType, UnionOf } from "unionize"; +import { Dispatch } from "redux"; +import { collectionService } from "../../services/services"; const actions = unionize({ CREATE_COLLECTION: ofType(), @@ -15,5 +17,13 @@ const actions = unionize({ value: 'payload' }); +export const getCollectionList = (parentUuid?: string) => (dispatch: Dispatch): Promise => { + dispatch(actions.COLLECTIONS_REQUEST()); + return collectionService.getCollectionList(parentUuid).then(collections => { + dispatch(actions.COLLECTIONS_SUCCESS({collections})); + return collections; + }); +}; + export type CollectionAction = UnionOf; export default actions;