Check if response is numeric
This commit is contained in:
parent
1c44616b06
commit
9b1e4bcd5e
@ -96,7 +96,8 @@ album = {
|
|||||||
|
|
||||||
var title,
|
var title,
|
||||||
params,
|
params,
|
||||||
buttons;
|
buttons,
|
||||||
|
isNumber = function(n) { return !isNaN(parseFloat(n)) && isFinite(n) };
|
||||||
|
|
||||||
buttons = [
|
buttons = [
|
||||||
["Create Album", function() {
|
["Create Album", function() {
|
||||||
@ -110,10 +111,10 @@ album = {
|
|||||||
params = "addAlbum&title=" + escape(encodeURI(title));
|
params = "addAlbum&title=" + escape(encodeURI(title));
|
||||||
lychee.api(params, function(data) {
|
lychee.api(params, function(data) {
|
||||||
|
|
||||||
if (data!==false) {
|
if (data===true) data = 1; // Avoid first album to be true
|
||||||
if (data===true) data = 1; // Avoid first album to be true
|
|
||||||
lychee.goto(data);
|
if (data!==false&&isNumber(data)) lychee.goto(data);
|
||||||
} else lychee.error(null, params, data);
|
else lychee.error(null, params, data);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user