diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-01-24 03:30:54 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-01-24 03:30:54 +0100 |
commit | 53654b3622de38c6cca5d29f9969eb9a67caf8a0 (patch) | |
tree | 0f34658f03ef8489d10d5bcddc11c9b7a258895c /extension/lib/wallet/wallet.ts | |
parent | b8627813be56e04c18baf38885f3a3dc0fb7496c (diff) | |
download | wallet-core-53654b3622de38c6cca5d29f9969eb9a67caf8a0.tar.xz |
Redirect to bank page on reserve creation success
Fixes #4084.
Diffstat (limited to 'extension/lib/wallet/wallet.ts')
-rw-r--r-- | extension/lib/wallet/wallet.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/extension/lib/wallet/wallet.ts b/extension/lib/wallet/wallet.ts index 2a931ae33..ab4c88da7 100644 --- a/extension/lib/wallet/wallet.ts +++ b/extension/lib/wallet/wallet.ts @@ -456,11 +456,16 @@ export class Wallet { return this.http.postForm(req.post_url, form) .then((hresp) => { + // TODO: look at response status code and handle errors appropriately + let json = JSON.parse(hresp.responseText); + if (!json) { + return { + success: false + }; + } let resp: ConfirmReserveResponse = { - status: hresp.status, - text: hresp.responseText, success: undefined, - backlink: undefined + backlink: json.redirect_url, }; let reserveRecord = { reserve_pub: reservePub.toCrock(), @@ -488,9 +493,7 @@ export class Wallet { }; resp.success = true; - // We can't show the page directly, so - // we show some generic page from the wallet. - resp.backlink = null; + return Query(this.db) .put("reserves", reserveRecord) .put("history", historyEntry) |