From b1d9e74652deae84bcfc3af484c92ddab710db17 Mon Sep 17 00:00:00 2001 From: Mark Goodrich Date: Thu, 14 Sep 2023 09:03:46 -0400 Subject: [PATCH] O3-2409: Login: support interpolation in loginUrl and logoutUrl (#766) --- packages/apps/esm-login-app/src/login/login.component.tsx | 4 ++-- .../src/redirect-logout/redirect-logout.component.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/apps/esm-login-app/src/login/login.component.tsx b/packages/apps/esm-login-app/src/login/login.component.tsx index a071195e4..9d2ddf940 100644 --- a/packages/apps/esm-login-app/src/login/login.component.tsx +++ b/packages/apps/esm-login-app/src/login/login.component.tsx @@ -18,6 +18,7 @@ import { clearCurrentUser, getSessionStore, useConnectivity, + navigate as openmrsNavigate, } from "@openmrs/esm-framework"; import { performLogin } from "../login.resource"; import styles from "./login.scss"; @@ -78,8 +79,7 @@ const Login: React.FC = () => { useEffect(() => { if (!user && config.provider.type === "oauth2") { - const loginUrl = config.provider.loginUrl; - window.location.href = loginUrl; + openmrsNavigate({ to: config.provider.loginUrl }); } }, [config, user]); diff --git a/packages/apps/esm-login-app/src/redirect-logout/redirect-logout.component.tsx b/packages/apps/esm-login-app/src/redirect-logout/redirect-logout.component.tsx index b952bf31a..a23c72599 100644 --- a/packages/apps/esm-login-app/src/redirect-logout/redirect-logout.component.tsx +++ b/packages/apps/esm-login-app/src/redirect-logout/redirect-logout.component.tsx @@ -20,7 +20,7 @@ const RedirectLogout: React.FC = () => { } else { performLogout().then(() => { if (config.provider.type === "oauth2") { - location.href = config.provider.logoutUrl; + navigate({ to: config.provider.logoutUrl }); } else { navigate({ to: "${openmrsSpaBase}/login" }); }