1
votes

I'm newbie to polymer. I'm not good at english... but I'm in here because there are not much articles about polymer in my mother-tongue language.

My question is... I want to change url(app-location's path) when iron-ajax request failed. but, when I try to change location, that's not working at the only first time.

for example, someone can't see articles until they not logged-in. the URLs that requires authentication are like this... "/list/board1, /list/board2", ... (/list url is require authentication)

It is working well when entere webpage through mainpage first. (/main -> /list/board1) If someone not logged-in try to view /list/board1, the page redirecting well.

But, when process like this... (/list/board1 -> user lost their authentication -> refresh page) this.set('route.path', '/unauthenticate'); this code not working.

I think setting location ignored by something when page not loaded completely.

How can I handle iron-ajax error right way? I want to redirect to error page when I got error.

Please let me know. thank you.

1

1 Answers

1
votes

You would do something like this:

<app-location route="{{route}}"></app-location>
<app-route route="{{route}}" pattern="/:page" data="{{data}}"></app-route>
<iron-ajax on-error="handleError"></iron-ajax>

And in the script:

handleError: function(error) {
  this.page = "errorPage"; // change route
}