smashingboxes / web-boilerplate

A template for new front-end projects.
3 stars 2 forks source link

Fix a bug with non-401 errors #52

Closed dkniffin closed 7 years ago

dkniffin commented 7 years ago

Why?

On backend non-401 errors (eg 422), users were being logged out.

What changed?

Added a missing else case for the invalidateHeaders interceptor. Basically, what was happening is when a 422 occurred, that function would get called (instead of saveTokenInfo). Since it wasn't a 401, it wouldn't log us out yet, but it also wouldn't save the response tokens. So on the next request, we'd send an old token, and the BE would 401, and we'd be kicked out.

leeallen337 commented 7 years ago

@dkniffin Probably going to have to fix that same test you did on stilio_fe

dkniffin commented 7 years ago

Well, I did fix it here. Not sure why this is erroring...

jahammo2 commented 7 years ago

Give Greg a chance to review this as well since he expressed interest in doing so in Slack. But I definitely give it a :shipit:. Good stuff man. Just get that test passing.

greg5green commented 7 years ago

👍