Support redirect responses from API calls

Several scratchr2 views do a thing and then redirect (project, studio creation, the student password reset middleware). This allows the client to redirect to that response.

Fixes GH-238. Requires LLK/scratchr2@bf451a95ea
This commit is contained in:
Ray Schamp 2015-11-26 11:59:25 -08:00
parent fafff50401
commit 815c4b3f57

View file

@ -34,6 +34,7 @@ var Api = {
}
xhr(opts, function (err, res, body) {
if (err) log.error(err);
if (body && body[0] && 'redirect' in body[0]) window.location = body[0].redirect;
callback(err, body);
});
}.bind(this);