-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Prevent multiple exitTo params from being added to the URL #179
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
Conversation
Jag96
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const urlWithExitTo = url && url !== '/' | ||
| // The /exitTo... part is only added to the URL if the url is NOT the root of the site and it DOESN'T | ||
| // already have "exitTo" in it. | ||
| const urlWithExitTo = url && url !== '/' && url.indexOf('exitTo') === -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think this is what we want here:
if (!url) {
return;
}
// If we already have exitTo, don't redirect
if (url.indexOf('exitTo') !== -1 || url.indexOf('signin') !== -1) {
return;
}
// If we're at the root, go to sign-in, otherwise add the exitTo
const urlWithExitTo = url !== '/'
? `${ROUTES.SIGNIN}/exitTo${url}`
: ROUTES.SIGNIN;
return Ion.set(IONKEYS.APP_REDIRECT_TO, urlWithExitTo);
I tested this with the following 3 cases:
- Sign out of the app and go to
http://localhost:8080/#/22, confirm you are taken tohttp://localhost:8080/#/signin/exitTo/22 - While signed out, navigate to
http://localhost:8080/, confirm you are taken tohttp://localhost:8080/#/signin - While signed out, navigate to
http://localhost:8080/#/signin/exitTo/22, confirm the URL doesn't change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like that works well! Thanks. Committing it now
|
Updated. I tested this by adding a timeout on the homepage (in componentDidMount) like this: Then logged in, went straight to a report. It redirected me to signIn, I signed in, then was back on the same report. |
…view-5 Fix issue: Workflows - RHP opens not here page when returning from Approver page

Fixes #177
Test
Difficult to test, so we'll just see how it works on production.