mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
surround redirect check in try/catch
based on the suggestion by @rschamp!
This commit is contained in:
parent
2e79a5aa6b
commit
e85563c96e
1 changed files with 5 additions and 1 deletions
|
@ -44,7 +44,11 @@ var Api = {
|
||||||
if (err) log.error(err);
|
if (err) log.error(err);
|
||||||
// Legacy API responses come as lists, and indicate to redirect the client like
|
// Legacy API responses come as lists, and indicate to redirect the client like
|
||||||
// [{success: true, redirect: "/location/to/redirect"}]
|
// [{success: true, redirect: "/location/to/redirect"}]
|
||||||
if (body && body[0] && 'redirect' in body[0]) window.location = body[0].redirect;
|
try {
|
||||||
|
if (body && body[0] && 'redirect' in body[0]) window.location = body[0].redirect;
|
||||||
|
} catch (err) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
callback(err, body);
|
callback(err, body);
|
||||||
});
|
});
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
Loading…
Reference in a new issue