Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not routing to expected route #119

Open
satishpatro44 opened this issue Apr 10, 2019 · 0 comments
Open

Not routing to expected route #119

satishpatro44 opened this issue Apr 10, 2019 · 0 comments

Comments

@satishpatro44
Copy link

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();
}

  1. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant