15064: Save/load homeCluster from localStorage.
[arvados-workbench2.git] / src / store / auth / auth-action.ts
index c06e064e3fcef1cb8cd2c560c4b7f77161d178e1..7ebbbaa633ab8fc794be450f6635edf6d691b45e 100644 (file)
@@ -50,10 +50,12 @@ function removeAuthorizationHeader(client: AxiosInstance) {
 export const initAuth = (config: Config) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
     const user = services.authService.getUser();
     const token = services.authService.getApiToken();
+    const homeCluster = services.authService.getHomeCluster();
     if (token) {
         setAuthorizationHeader(services, token);
     }
     dispatch(authActions.CONFIG({ config }));
+    dispatch(authActions.SET_HOME_CLUSTER(homeCluster || config.uuidPrefix));
     if (token && user) {
         dispatch(authActions.INIT({ user, token }));
         dispatch<any>(initSessions(services.authService, config, user));