X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e677489047822fed2dcd48d904ccc46fae5b1615..ccf093578f01b3d8ac0c421f85063939b3cd271d:/src/store/auth/auth-action.ts diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts index baf80595..09d922e0 100644 --- a/src/store/auth/auth-action.ts +++ b/src/store/auth/auth-action.ts @@ -10,8 +10,9 @@ import { ServiceRepository } from "~/services/services"; import { SshKeyResource } from '~/models/ssh-key'; import { User } from "~/models/user"; import { Session } from "~/models/session"; -import { Config } from '~/common/config'; +import { getDiscoveryURL, Config } from '~/common/config'; import { initSessions } from "~/store/auth/auth-action-session"; +import Axios from "axios"; export const authActions = unionize({ SAVE_API_TOKEN: ofType(), @@ -28,7 +29,8 @@ export const authActions = unionize({ SET_SESSIONS: ofType(), ADD_SESSION: ofType(), REMOVE_SESSION: ofType(), - UPDATE_SESSION: ofType() + UPDATE_SESSION: ofType(), + REMOTE_CLUSTER_CONFIG: ofType<{ config: Config }>(), }); function setAuthorizationHeader(services: ServiceRepository, token: string) { @@ -57,6 +59,10 @@ export const initAuth = (config: Config) => (dispatch: Dispatch, getState: () => dispatch(getUserDetails()).then((user: User) => { dispatch(authActions.INIT({ user, token })); }); + Object.keys(config.remoteHosts).map((k) => { + Axios.get(getDiscoveryURL(config.remoteHosts[k])) + .then(response => dispatch(authActions.REMOTE_CLUSTER_CONFIG({ config: response.data }))); + }); } };