From 0f8e9b67dd1dede142f0cb25406f212d07da7b3f Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Wed, 1 Dec 2021 14:57:37 -0300
Subject: exportDb call to the wallet-core

---
 packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx')

diff --git a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
index 8d24545d5..b32555248 100644
--- a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
@@ -46,7 +46,10 @@ export function DeveloperPage(): VNode {
   return <View status={status} 
     timedOut={timedOut} 
     operations={operations} 
-    onDownloadDatabase={async () => "content"}
+    onDownloadDatabase={async () => {
+      const db = await wxApi.exportDB()
+      return JSON.stringify(db)
+    }}
   />;
 }
 
@@ -81,7 +84,7 @@ export function View({ status, timedOut, operations, onDownloadDatabase }: Props
       <br />
       <button onClick={onExportDatabase}>export database</button>
       {downloadedDatabase && <div>
-        Database exported at <Time timestamp={{t_ms: downloadedDatabase.time.getTime()}} format="yyyy/MM/dd HH:mm:ss" /> <a href={`data:text/plain;charset=utf-8;base64,${Buffer.from(downloadedDatabase.content).toString('base64')}`} download={`taler-wallet-database-${format(downloadedDatabase.time, 'yyyy/MM/dd_HH:mm')}.json`}>click here</a> to download
+        Database exported at <Time timestamp={{t_ms: downloadedDatabase.time.getTime()}} format="yyyy/MM/dd HH:mm:ss" /> <a href={`data:text/plain;charset=utf-8;base64,${btoa(downloadedDatabase.content)}`} download={`taler-wallet-database-${format(downloadedDatabase.time, 'yyyy/MM/dd_HH:mm')}.json`}>click here</a> to download
         </div>}
       <br />
       <Diagnostics diagnostics={status} timedOut={timedOut} />
-- 
cgit v1.2.3

