Create actions and selectors for file viewers
[arvados-workbench2.git] / src / store / file-viewers / file-viewers-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch } from 'redux';
6 import { ServiceRepository } from '~/services/services';
7 import { propertiesActions } from '~/store/properties/properties-actions';
8 import { FILE_VIEWERS_PROPERTY_NAME } from '~/store/file-viewers/file-viewers-selectors';
9
10 export const loadFileViewersConfig = async (dispatch: Dispatch, _: {}, { fileViewersConfig }: ServiceRepository) => {
11
12     const config = await fileViewersConfig.get();
13
14     dispatch(propertiesActions.SET_PROPERTY({
15         key: FILE_VIEWERS_PROPERTY_NAME,
16         value: config,
17     }));
18
19 };