mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 02:56:20 -05:00
Merge pull request #259 from rschamp/bugfix/GH-238
Support redirect responses from API calls
This commit is contained in:
commit
458c112e6c
1 changed files with 3 additions and 0 deletions
|
@ -34,6 +34,9 @@ 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;
|
||||||
callback(err, body);
|
callback(err, body);
|
||||||
});
|
});
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
Loading…
Reference in a new issue