I have a webapp where login, logout can be done in any route '/' or '/browseIdea' or '/myIdea' basically in header.
Now, I want it to redirect from which ever route it is calling login() & logout().
postLogoutRedirectUri: window.location.href
But, on login() & logout(), it was always redirecting to 'https://localhost:4200'.
As, mainly because it is set in app.component.ts and it will init on refresh, but when i am redirecting to another page, it is notrefreshing(Single Page Application). So, no call to ngOnInit(), so no change of postLogoutRedirectUri. So, I though while calling login function I will call init(). so, window.location.href value will get updated
Now the async problem is happening. some time it is updating redirectUrl to particualr route due to init() if it executed before login() starts and there I am getting expected output, but when adalService.login() executes before completion it redirect to previous route(as previous time init may have executed later, so it was storing old route)
How to make it sync. Both are void() or adal-service only gives some features?
Mainly both returns void. So, I can not able to subscribe too
And, I even tried to write init() in all component's ngOnInit() which means on loading of each component it will change value of postLogoutRedirectUri. But, I am still facing same issue
I have a webapp where login, logout can be done in any route '/' or '/browseIdea' or '/myIdea' basically in header.
Now, I want it to redirect from which ever route it is calling login() & logout().
postLogoutRedirectUri: window.location.href But, on login() & logout(), it was always redirecting to 'https://localhost:4200'.
As, mainly because it is set in app.component.ts and it will init on refresh, but when i am redirecting to another page, it is notrefreshing(Single Page Application). So, no call to ngOnInit(), so no change of postLogoutRedirectUri. So, I though while calling login function I will call init(). so, window.location.href value will get updated
That's why I added adalService.init()
login() { this.adalService.init(environment.adalConfig); this.adalService.login(); }
How to make it sync. Both are void() or adal-service only gives some features? Mainly both returns void. So, I can not able to subscribe too
And, I even tried to write init() in all component's ngOnInit() which means on loading of each component it will change value of postLogoutRedirectUri. But, I am still facing same issue