diff --git a/packages/web-app/src/modules/auth/AuthStore.tsx b/packages/web-app/src/modules/auth/AuthStore.tsx index c0c9dbd17..e9199b689 100644 --- a/packages/web-app/src/modules/auth/AuthStore.tsx +++ b/packages/web-app/src/modules/auth/AuthStore.tsx @@ -36,12 +36,12 @@ export class AuthStore { } @action - public login = async (): Promise => { + public login = async (redirectUri?: string): Promise => { // Don't do anything if we are already logged in try { await this.axios.get('/api/v1/profile').then(() => runInAction(() => (this.isAuthenticated = true))) } catch { - const routeWithoutTrailingSlash = this.store.routing.location.pathname.slice(1) + const routeWithoutTrailingSlash = redirectUri ?? this.store.routing.location.pathname.slice(1) window.location.assign(`${config.loginUrl}?redirect_uri=${routeWithoutTrailingSlash}`) } diff --git a/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPageContainer.tsx b/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPageContainer.tsx index a5a4bd244..2c00795ff 100644 --- a/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPageContainer.tsx +++ b/packages/web-app/src/modules/demand-monitor-views/DemandMonitorPage/DemandMonitorPageContainer.tsx @@ -19,7 +19,7 @@ export const _DemandMonitorPageContainer: FC = ({ isAuth const mapStoreToProps = (store: RootStore): any => ({ onLoginClick: () => { store.analytics.trackButtonClicked('login_button', 'Log In Button', 'enabled') - store.auth.login() + store.auth.login('/account/alerts') }, fetchDemandedHardwarePerformanceList: store.demandMonitor.fetchDemandedHardwarePerformanceList, navigateToDemandAlerts: () => store.routing.push('/account/alerts'),