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

Add options for error pages #12

Closed
TristanPct opened this issue Aug 21, 2018 · 4 comments
Closed

Add options for error pages #12

TristanPct opened this issue Aug 21, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@TristanPct
Copy link

Hello, it's me again 😄

For the moment when Highway encounter an error page (404, 500...) it sends the NAVIGATE_ERROR event but doesn't try to load the page (event if this page have a router-view).

Is it planned to add an option to load error pages likes other pages ?

For the moment an alternative is to tell the error page to have an HTTP 200 code rather than error code if X-Requested-With: Highway header is present.

@Anthodpnt
Copy link
Contributor

Hi @TristanPct ,

We are currently working on the v2.0 of Highway...

We have add a new method called location to Highway.Core that'll give you the ability to redirect to a page like you would do with window.location but using Highway.

So I would say that since the NAVIGATE_ERROR event gives you acces to the HTTP/Request status, you'll be able to know the status code and use this method to redirect to the right error page using this new method. What do you think ?

Cheers,
Anthodpnt

@Anthodpnt Anthodpnt added the enhancement New feature or request label Aug 21, 2018
@TristanPct
Copy link
Author

👍 This method could be usefull, for this case or others.

But with this technique the browser load the error page twice (for the NAVIGATE_ERROR and for the location method).

Perhaps a method or parameter in the NAVIGATE_ERROR event telling continue anyway (like event.continueRouting() for example) could avoid this double page load.

@Anthodpnt
Copy link
Contributor

@TristanPct I understand what you mean and we'll look into a cleaner solution as soon as possible.

@Anthodpnt
Copy link
Contributor

@TristanPct We juste released the v2.0.0 of Highway that will fix your issue. Since we cannot predict that there will be an error or that an error page is provided we have to hard reload the page as soon as the response.status of the HTTPRequest is outside the 200-299 range.

Best regards,
Anthodpnt

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

No branches or pull requests

2 participants