Skip to content
Snippets Groups Projects
Commit c57be493 authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Show retry-after to users when available

parent 43ee3fd0
No related branches found
No related tags found
No related merge requests found
......@@ -25,15 +25,17 @@
url: $(selector).attr("action"),
data: $(selector).serialize(),
})
.done(function(jqXHR, response) {
.done(function(response, textStatus, jqXHR) {
$(selector).html(response)
})
.fail(function(jqXHR, response) {
if (jqXHR.statusCode() == 429) {
if (jqXHR.getResponseHeader("Retry-After")) {
.fail(function(jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 429) {
var retry = jqXHR.getResponseHeader('Retry-After');
if (retry) {
alert("Too many requests from your network. Please try again in "
+ jqXHR.getResponseHeader("Retry-After") + " seconds.");
+ retry + " seconds.");
} else {
console.log(jqXHR);
alert("Too many requests from your network. Please try again later.");
}
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment