diff options
Diffstat (limited to 'extension/pages/confirm-contract.js')
-rw-r--r-- | extension/pages/confirm-contract.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/extension/pages/confirm-contract.js b/extension/pages/confirm-contract.js index 60de27e90..2c12211f6 100644 --- a/extension/pages/confirm-contract.js +++ b/extension/pages/confirm-contract.js @@ -20,8 +20,7 @@ document.addEventListener("DOMContentLoaded", (e) => { console.dir(offer); let source = $_("contract-template").innerHTML; let template = Handlebars.compile(source); - let html = template(offer.contract); - $_("render-contract").innerHTML = html; + $_("render-contract").innerHTML = template(offer.contract); document.getElementById("confirm-pay").addEventListener("click", (e) => { console.log("Query:", JSON.stringify(query)); let d = { @@ -29,13 +28,16 @@ document.addEventListener("DOMContentLoaded", (e) => { merchantPageUrl: query.merchantPageUrl }; chrome.runtime.sendMessage({ type: 'confirm-pay', detail: d }, (resp) => { - console.log("got response", resp); - if ("error" in resp) { + if (!resp.success) { let source = $_("error-template").innerHTML; let template = Handlebars.compile(source); $_("status").innerHTML = template(resp); return; } + document.location.href = URI(d.offer.exec_url) + .absoluteTo(query.merchantPageUrl) + .addQuery({ H_contract: d.offer.H_contract }) + .href(); }); }); }); |