Skip to content
New issue

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

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

Already on GitHub? # to your account

can exit trigger prevent route change? #170

Closed
jamgold opened this issue Jun 18, 2015 · 9 comments
Closed

can exit trigger prevent route change? #170

jamgold opened this issue Jun 18, 2015 · 9 comments

Comments

@jamgold
Copy link

jamgold commented Jun 18, 2015

I am trying to perform a check on route exit that should possible prevent the route to change (like form entries not saved). How can I abort the route change?

@arunoda
Copy link
Contributor

arunoda commented Jun 19, 2015

Yes. It'll soon. We are working on that.

On Fri, Jun 19, 2015 at 1:13 AM Jan Hendrik Mangold <
notifications@github.com> wrote:

I am trying to perform a check on route exit that should possible prevent
the route to change (like form entries not saved). How can I abort the
route change?


Reply to this email directly or view it on GitHub
#170.

@arunoda
Copy link
Contributor

arunoda commented Jun 19, 2015

I've just implemented it and waiting for others feedback. Could you have a look at this PR. There's a solution for you.

@jamgold
Copy link
Author

jamgold commented Jun 19, 2015

I checked it with the PR but am not sure how it is supposed to work. Are you saying I should redirect(context.path) in the exit trigger to abort?

@arunoda
Copy link
Contributor

arunoda commented Jun 20, 2015

Our redirect API need to have a URL everytime. So, you need to give it like above.

But, you are doing it in the exit handler, so still context.path is the current URL.
So, it tries to redirect to the same URL. Since we've idempotent URLs, route doesn't want.

may be you are looking for direct stop() API?

@jamgold
Copy link
Author

jamgold commented Jun 20, 2015

may be you are looking for direct stop() API?

Yes, I think that would be clean(er).

@arunoda
Copy link
Contributor

arunoda commented Jun 20, 2015

Got it.

@arunoda
Copy link
Contributor

arunoda commented Jun 20, 2015

I think we will stick with the redirect API. You don't have a stop API.
If you need to do more validations, I prefer doing it before routing.

When user came to a exit trigger, stoping the route make no sense.
You need to at least change a query parameter to change it.

@jamgold
Copy link
Author

jamgold commented Jun 20, 2015

OK, closing this issue then

@jamgold jamgold closed this as completed Jun 20, 2015
@space-alien
Copy link

@jamgold my comments on #318 may be relevant.

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

No branches or pull requests

3 participants