In the end, I want to catch a 302 error and redirect to my login page, but right now xhr.status is getting a status code of 200.
Here's my current code:
parentSyncMethod = Backbone.sync
Backbone.sync = (method, model, options) ->
old_error = options.old_error
options.error = (xhr, text_status, error_thrown) ->
if(xhr.status == 302)
window.location.replace('http://localhost:8080/login')
else
old_error?(xhr, text_status, error_thrown)
parentSyncMethod(method, model, options)
basically I think the problem is that the current webpage is throwing the 200 error, but the one that's throwing the 302 is wrapped and not propagating to the xhr.status. Is there a way to get all status code responses from all the get, post, put, etc. calls that have been made?