1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { dialogActions } from "~/store/dialog/dialog-actions";
6 import { getProperty } from '../properties/properties';
7 import { propertiesActions } from '~/store/properties/properties-actions';
8 import { RootState } from '~/store/store';
10 export const CURRENT_TOKEN_DIALOG_NAME = 'currentTokenDialog';
11 const API_HOST_PROPERTY_NAME = 'apiHost';
13 export interface CurrentTokenDialogData {
18 export const setCurrentTokenDialogApiHost = (apiHost: string) =>
19 propertiesActions.SET_PROPERTY({ key: API_HOST_PROPERTY_NAME, value: apiHost });
21 export const getCurrentTokenDialogData = (state: RootState): CurrentTokenDialogData => ({
22 apiHost: getProperty<string>(API_HOST_PROPERTY_NAME)(state.properties) || '',
23 currentToken: state.auth.apiToken || '',
26 export const openCurrentTokenDialog = dialogActions.OPEN_DIALOG({ id: CURRENT_TOKEN_DIALOG_NAME, data: {} });