From eb84d5747aac0de781d64fb9cdbf2da13006d85e Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 13 Nov 2016 10:17:39 +0100 Subject: fix small react issues --- content_scripts/notify.ts | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'content_scripts/notify.ts') 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 { + 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) { -- cgit v1.2.3