15088: Adds logout before logging in to second account
authorEric Biagiotti <ebiagiotti@veritasgenetics.com>
Wed, 8 May 2019 19:36:59 +0000 (15:36 -0400)
committerEric Biagiotti <ebiagiotti@veritasgenetics.com>
Wed, 8 May 2019 19:36:59 +0000 (15:36 -0400)
Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>

src/store/link-account-panel/link-account-panel-actions.ts

index 5e7a02b4d4d89bf4f20cf0b3ac7cb39ec2ec2276..546573776136db30027e4ab62dbc63690ed86def 100644 (file)
@@ -14,6 +14,7 @@ import { UserResource } from "~/models/user";
 import { GroupResource } from "~/models/group";
 import { LinkAccountPanelError, OriginatingUser } from "./link-account-panel-reducer";
 import { navigateToRootProject } from "../navigation/navigation-action";
+import { login, logout } from "~/store/auth/auth-action";
 
 export const linkAccountPanelActions = unionize({
     LINK_INIT: ofType<{ targetUser: UserResource | undefined }>(),
@@ -151,7 +152,8 @@ export const saveAccountLinkData = (t: LinkAccountType) =>
         const accountToLink = {type: t, userUuid: services.authService.getUuid(), token: services.authService.getApiToken()} as AccountToLink;
         services.linkAccountService.saveToSession(accountToLink);
         const auth = getState().auth;
-        services.authService.login(auth.localCluster, auth.remoteHosts[auth.homeCluster]);
+        dispatch(logout());
+        dispatch(login(auth.localCluster, auth.remoteHosts[auth.homeCluster]));
     };
 
 export const getAccountLinkData = () =>