fix incorrect function called on retry
This commit is contained in:
parent
a598e287df
commit
a8ab0b9a72
|
|
@ -38,7 +38,7 @@ function getGameState(gameId, retries) {
|
||||||
getGameState(gameId, retries - 1).then(resolve, reject);
|
getGameState(gameId, retries - 1).then(resolve, reject);
|
||||||
}, RETRY_DELAY);
|
}, RETRY_DELAY);
|
||||||
} else {
|
} else {
|
||||||
reject({ status: jqXHR.status, textStatus, errorThrown });
|
reject({ status: jqXHR.status, data: jqXHR.responseJSON, textStatus, errorThrown });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -61,10 +61,10 @@ function getGameMeta(gameId, retries) {
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
if ((!jqXHR.status || jqXHR.status < 400 || jqXHR.status > 499) && retries > 0) {
|
if ((!jqXHR.status || jqXHR.status < 400 || jqXHR.status > 499) && retries > 0) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getGameState(gameId, retries - 1).then(resolve, reject);
|
getGameMeta(gameId, retries - 1).then(resolve, reject);
|
||||||
}, RETRY_DELAY);
|
}, RETRY_DELAY);
|
||||||
} else {
|
} else {
|
||||||
reject({ status: jqXHR.status, textStatus, errorThrown });
|
reject({ status: jqXHR.status, data: jqXHR.responseJSON, textStatus, errorThrown });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -152,10 +152,10 @@ function sendUpdate(gameId, data, retries) {
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
if ((!jqXHR.status || jqXHR.status < 400 || jqXHR.status > 499) && retries > 0) {
|
if ((!jqXHR.status || jqXHR.status < 400 || jqXHR.status > 499) && retries > 0) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getGameState(gameId, retries - 1).then(resolve, reject);
|
sendUpdate(gameId, data, retries - 1).then(resolve, reject);
|
||||||
}, RETRY_DELAY);
|
}, RETRY_DELAY);
|
||||||
} else {
|
} else {
|
||||||
reject({ status: jqXHR.status, textStatus, errorThrown });
|
reject({ status: jqXHR.status, data: jqXHR.responseJSON, textStatus, errorThrown });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue