diff options
author | Frankie <frankie.pangilinan@consensys.net> | 2016-09-13 08:27:14 +0800 |
---|---|---|
committer | Frankie <frankie.pangilinan@consensys.net> | 2016-09-13 08:27:14 +0800 |
commit | 218f380d874f0efef4b87803c3f9cbd508391a9e (patch) | |
tree | a3b1fac7ded99c4194c85aacbe932453e81ded14 /ui/app/actions.js | |
parent | b8f75e387a91135b870c9f268977445c8e0877a4 (diff) | |
download | tangerine-wallet-browser-218f380d874f0efef4b87803c3f9cbd508391a9e.tar tangerine-wallet-browser-218f380d874f0efef4b87803c3f9cbd508391a9e.tar.gz tangerine-wallet-browser-218f380d874f0efef4b87803c3f9cbd508391a9e.tar.bz2 tangerine-wallet-browser-218f380d874f0efef4b87803c3f9cbd508391a9e.tar.lz tangerine-wallet-browser-218f380d874f0efef4b87803c3f9cbd508391a9e.tar.xz tangerine-wallet-browser-218f380d874f0efef4b87803c3f9cbd508391a9e.tar.zst tangerine-wallet-browser-218f380d874f0efef4b87803c3f9cbd508391a9e.zip |
Add qrcode-npm to package.json and swap out Qr Code generator api for node-module
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 50 |
1 files changed, 11 insertions, 39 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 57c2bf3e8..289366db0 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -134,7 +134,7 @@ var actions = { hideSubLoadingIndication: hideSubLoadingIndication, // QR STUFF: SHOW_QR: 'SHOW_QR', - getQr: getQr, + showQrView: showQrView, reshowQrCode: reshowQrCode, SHOW_QR_VIEW: 'SHOW_QR_VIEW', // FORGOT PASSWORD: @@ -739,25 +739,18 @@ function coinShiftRquest (data, marketData) { var message = ` Deposit your ${response.depositType} to the address bellow:` _accountManager.createShapeShiftTx(response.deposit, response.depositType) - dispatch(actions.getQr(response.deposit, '125x125', [message].concat(marketData))) + dispatch(actions.showQrView(response.deposit, [message].concat(marketData))) }) } } -function getQr (data, size, message) { - return (dispatch) => { - qrRequest(data, size, (response) => { - dispatch(actions.hideLoadingIndication()) - if (response.error) return dispatch(actions.showWarning(response.error)) - dispatch({ - type: actions.SHOW_QR, - value: { - qr: response, - message: message, - data: data, - }, - }) - }) +function showQrView (data, message) { + return { + type: actions.SHOW_QR_VIEW, + value: { + message: message, + data: data, + }, } } function reshowQrCode (data, coin) { @@ -772,17 +765,8 @@ function reshowQrCode (data, coin) { `Deposit Minimum:${mktResponse.minimum}`, ] - qrRequest(data, '125x125', (response) => { - dispatch(actions.hideLoadingIndication()) - dispatch({ - type: actions.SHOW_QR_VIEW, - value: { - qr: response, - message: message, - data: data, - }, - }) - }) + dispatch(actions.hideLoadingIndication()) + return dispatch(actions.showQrView(data, message)) }) } } @@ -810,15 +794,3 @@ function shapeShiftRequest (query, options, cb) { return shapShiftReq.send() } } - -function qrRequest (data, size, cb) { - var requestListner = function (request) { - cb ? cb(this.responseText) : null - return this.responseText - } - - var qrReq = new XMLHttpRequest() - qrReq.addEventListener('load', requestListner) - qrReq.open('GET', `https://api.qrserver.com/v1/create-qr-code/?size=${size}&format=svg&data=${data}`, true) - qrReq.send() -} |