Explain strange redirect behavior

This commit is contained in:
Ray Schamp 2015-12-10 17:11:25 -05:00
parent 815c4b3f57
commit 68bcbf7511

View file

@ -34,6 +34,8 @@ var Api = {
} }
xhr(opts, function (err, res, body) { xhr(opts, function (err, res, body) {
if (err) log.error(err); if (err) log.error(err);
// Legacy API responses come as lists, and indicate to redirect the client like
// [{success: true, redirect: "/location/to/redirect"}]
if (body && body[0] && 'redirect' in body[0]) window.location = body[0].redirect; if (body && body[0] && 'redirect' in body[0]) window.location = body[0].redirect;
callback(err, body); callback(err, body);
}); });