[ARVADOS-WORKBENCH2] updated: 2.1.0-56-g54e734a4

Git user git at public.arvados.org
Wed Nov 11 21:33:31 UTC 2020


Summary of changes:
 src/services/auth-service/auth-service.ts    |  5 +++--
 src/views-components/api-token/api-token.tsx | 13 +++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)

       via  54e734a4074911ce516a65c7195c84ad523adc75 (commit)
      from  f8c0598de3b7b55df719b6b5519d044ca256f367 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 54e734a4074911ce516a65c7195c84ad523adc75
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Wed Nov 11 16:33:12 2020 -0500

    17101: Use redux router instead of setting window.location.href
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index d075a734..8d27b5bb 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -63,7 +63,7 @@ export class AuthService {
     }
 
     public getTargetURL() {
-       return this.getStorage().getItem(TARGET_URL);
+        return this.getStorage().getItem(TARGET_URL);
     }
 
     public removeApiToken() {
@@ -98,7 +98,8 @@ export class AuthService {
     public login(uuidPrefix: string, homeCluster: string, loginCluster: string, remoteHosts: { [key: string]: string }) {
         const currentUrl = `${window.location.protocol}//${window.location.host}/token`;
         const homeClusterHost = remoteHosts[homeCluster];
-        this.getStorage().setItem(TARGET_URL, window.location.href);
+        const rd = new URL(window.location.href);
+        this.getStorage().setItem(TARGET_URL, rd.pathname + rd.search);
         window.location.assign(`https://${homeClusterHost}/login?${(uuidPrefix !== homeCluster && homeCluster !== loginCluster) ? "remote=" + uuidPrefix + "&" : ""}return_to=${currentUrl}`);
     }
 
diff --git a/src/views-components/api-token/api-token.tsx b/src/views-components/api-token/api-token.tsx
index 955d6920..f4b50e36 100644
--- a/src/views-components/api-token/api-token.tsx
+++ b/src/views-components/api-token/api-token.tsx
@@ -11,6 +11,7 @@ import { AuthService } from "~/services/auth-service/auth-service";
 import { navigateToRootProject, navigateToLinkAccount } from "~/store/navigation/navigation-action";
 import { Config } from "~/common/config";
 import { getAccountLinkData } from "~/store/link-account-panel/link-account-panel-actions";
+import { replace } from "react-router-redux";
 
 interface ApiTokenProps {
     authService: AuthService;
@@ -27,12 +28,12 @@ export const ApiToken = connect()(
             this.props.dispatch<any>(saveApiToken(apiToken)).finally(() => {
                 const redirectURL = this.props.authService.getTargetURL();
 
-                if (redirectURL) {
-                    this.props.authService.removeTargetURL();
-                    window.location.href = redirectURL;
-                }
-                else if (loadMainApp) {
-                    if (this.props.dispatch(getAccountLinkData())) {
+                if (loadMainApp) {
+                    if (redirectURL) {
+                        this.props.authService.removeTargetURL();
+                        this.props.dispatch(replace(redirectURL));
+                    }
+                    else if (this.props.dispatch(getAccountLinkData())) {
                         this.props.dispatch(navigateToLinkAccount);
                     }
                     else {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list