Fix retry on timeout for AJAX requests

This commit is contained in:
Omar Roth 2019-06-15 10:08:06 -05:00
parent a3164177f8
commit 552f616305
No known key found for this signature in database
GPG key ID: B8254FB7EC3D37F2
9 changed files with 110 additions and 53 deletions

View file

@ -9,7 +9,6 @@ function mark_watched(target) {
xhr.timeout = 20000;
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('csrf_token=' + watched_data.csrf_token);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
@ -18,6 +17,8 @@ function mark_watched(target) {
}
}
}
xhr.send('csrf_token=' + watched_data.csrf_token);
}
function mark_unwatched(target) {
@ -33,7 +34,6 @@ function mark_unwatched(target) {
xhr.timeout = 20000;
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('csrf_token=' + watched_data.csrf_token);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
@ -43,4 +43,6 @@ function mark_unwatched(target) {
}
}
}
xhr.send('csrf_token=' + watched_data.csrf_token);
}