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
9 changed files with 110 additions and 53 deletions

View File

@@ -68,7 +68,6 @@ function remove_subscription(target) {
xhr.timeout = 20000;
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>');
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
@@ -78,5 +77,7 @@ function remove_subscription(target) {
}
}
}
xhr.send('csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>');
}
</script>

View File

@@ -60,7 +60,6 @@ function revoke_token(target) {
xhr.timeout = 20000;
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>');
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
@@ -70,5 +69,7 @@ function revoke_token(target) {
}
}
}
xhr.send('csrf_token=<%= URI.escape(env.get?("csrf_token").try &.as(String) || "") %>');
}
</script>