X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a886877017be6744b38d84d52503d21892704139..1feb5aaffe6fee4a9c8c8c64877f1da6f3490e06:/src/store/details-panel/details-panel-action.ts diff --git a/src/store/details-panel/details-panel-action.ts b/src/store/details-panel/details-panel-action.ts index 630428cf2b..03212b9fc9 100644 --- a/src/store/details-panel/details-panel-action.ts +++ b/src/store/details-panel/details-panel-action.ts @@ -3,39 +3,37 @@ // SPDX-License-Identifier: AGPL-3.0 import { unionize, ofType, UnionOf } from "unionize"; -import CommonResourceService from "../../common/api/common-resource-service"; +import { CommonResourceService } from "../../common/api/common-resource-service"; import { Dispatch } from "redux"; -import { serverApi } from "../../common/api/server-api"; +import { apiClient } from "../../common/api/server-api"; import { Resource, ResourceKind } from "../../models/resource"; -const actions = unionize({ +export const detailsPanelActions = unionize({ TOGGLE_DETAILS_PANEL: ofType<{}>(), LOAD_DETAILS: ofType<{ uuid: string, kind: ResourceKind }>(), LOAD_DETAILS_SUCCESS: ofType<{ item: Resource }>(), }, { tag: 'type', value: 'payload' }); -export default actions; - -export type DetailsPanelAction = UnionOf; +export type DetailsPanelAction = UnionOf; export const loadDetails = (uuid: string, kind: ResourceKind) => (dispatch: Dispatch) => { - dispatch(actions.LOAD_DETAILS({ uuid, kind })); + dispatch(detailsPanelActions.LOAD_DETAILS({ uuid, kind })); getService(kind) .get(uuid) .then(project => { - dispatch(actions.LOAD_DETAILS_SUCCESS({ item: project })); + dispatch(detailsPanelActions.LOAD_DETAILS_SUCCESS({ item: project })); }); }; const getService = (kind: ResourceKind) => { switch (kind) { - case ResourceKind.Project: - return new CommonResourceService(serverApi, "groups"); - case ResourceKind.Collection: - return new CommonResourceService(serverApi, "collections"); + case ResourceKind.PROJECT: + return new CommonResourceService(apiClient, "groups"); + case ResourceKind.COLLECTION: + return new CommonResourceService(apiClient, "collections"); default: - return new CommonResourceService(serverApi, ""); + return new CommonResourceService(apiClient, ""); } };