Skip to content

Commit

Permalink
[SALAD-23183] WebApp - Redirect to Demand Alerts Page on successful l…
Browse files Browse the repository at this point in the history
…ogin (#1240)
  • Loading branch information
Maks19 authored Dec 9, 2024
1 parent 0ea9695 commit 99e741e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/web-app/src/modules/auth/AuthStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export class AuthStore {
}

@action
public login = async (): Promise<void> => {
public login = async (redirectUri?: string): Promise<void> => {
// 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}`)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const _DemandMonitorPageContainer: FC<DemandMonitorPageProps> = ({ 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'),
Expand Down

0 comments on commit 99e741e

Please sign in to comment.