[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-blog] branch master updated: check response instead
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-blog] branch master updated: check response instead of request for status; parse JSON robustly |
Date: |
Tue, 27 Aug 2019 01:13:47 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository blog.
The following commit(s) were added to refs/heads/master by this push:
new 381f245 check response instead of request for status; parse JSON
robustly
381f245 is described below
commit 381f245b7b8beb82a0c6d83412c4103c2f6e56e6
Author: Florian Dold <address@hidden>
AuthorDate: Tue Aug 27 01:13:44 2019 +0200
check response instead of request for status; parse JSON robustly
---
talerblog/blog/blog.py | 2 +-
talerblog/blog/templates/request_payment.html | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/talerblog/blog/blog.py b/talerblog/blog/blog.py
index d652808..ba10453 100644
--- a/talerblog/blog/blog.py
+++ b/talerblog/blog/blog.py
@@ -243,7 +243,7 @@ def check_status(order_id, session_id):
order_id=order_id,
session_id=session_id)
pay_status = backend_get("check-payment", pay_params)
- return flask.jsonify(paid=pay_params["paid"])
+ return flask.jsonify(paid=pay_status["paid"])
##
# Trigger a article purchase. The logic follows the main steps:
diff --git a/talerblog/blog/templates/request_payment.html
b/talerblog/blog/templates/request_payment.html
index 6c14456..f138877 100644
--- a/talerblog/blog/templates/request_payment.html
+++ b/talerblog/blog/templates/request_payment.html
@@ -17,9 +17,13 @@
req.onreadystatechange = function () {
if (req.readyState === XMLHttpRequest.DONE && req.status === 200) {
if (req.status === 200) {
- let resp = JSON.parse(req.responseText);
- if (resp.paid) {
- document.location.reload(true);
+ try {
+ let resp = JSON.parse(req.responseText);
+ if (resp.paid) {
+ document.location.reload(true);
+ }
+ } catch (e) {
+ console.error("could not parse response:", e);
}
}
setTimeout(check, delayMs);
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-blog] branch master updated: check response instead of request for status; parse JSON robustly,
gnunet <=