aboutsummaryrefslogtreecommitdiff
path: root/content_scripts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-13 10:17:39 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-13 10:17:39 +0100
commiteb84d5747aac0de781d64fb9cdbf2da13006d85e (patch)
tree387d7711e177d151a185e2a9a870c39cc03926ce /content_scripts
parentb2128609ac8159a14224deba399144b3400c8c20 (diff)
downloadwallet-core-eb84d5747aac0de781d64fb9cdbf2da13006d85e.tar.xz
fix small react issues
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/notify.ts23
1 files changed, 21 insertions, 2 deletions
diff --git a/content_scripts/notify.ts b/content_scripts/notify.ts
index 3b7b231c3..93fd520b3 100644
--- a/content_scripts/notify.ts
+++ b/content_scripts/notify.ts
@@ -102,6 +102,25 @@ namespace TalerNotify {
});
}
+ function saveOffer(offer: any): Promise<number> {
+ const walletMsg = {
+ type: "save-offer",
+ detail: {
+ offer: {
+ contract: offer.contract,
+ merchant_sig: offer.merchant_sig,
+ H_contract: offer.H_contract,
+ offer_time: new Date().getTime() / 1000
+ },
+ },
+ };
+ return new Promise((resolve, reject) => {
+ chrome.runtime.sendMessage(walletMsg, (resp: any) => {
+ resolve(resp);
+ });
+ });
+ }
+
function init() {
chrome.runtime.sendMessage({type: "get-tab-cookie"}, (resp) => {
if (chrome.runtime.lastError) {
@@ -270,12 +289,12 @@ namespace TalerNotify {
}
};
await putHistory(historyEntry);
+ let offerId = await saveOffer(offer);
const uri = URI(chrome.extension.getURL(
"pages/confirm-contract.html"));
const params = {
- offer: JSON.stringify(offer),
- merchantPageUrl: document.location.href,
+ offerId: offerId.toString(),
};
const target = uri.query(params).href();
if (msg.replace_navigation === true) {