From bac97e5c93dade0215de2f19cce3df8a7d136fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Mon, 3 Jun 2019 16:32:45 +0200 Subject: [PATCH] Make message optional in Request --- src/components/SendByScan.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/SendByScan.js b/src/components/SendByScan.js index 080fb32f1..47ffc49e3 100644 --- a/src/components/SendByScan.js +++ b/src/components/SendByScan.js @@ -103,11 +103,15 @@ class SendByScan extends Component { console.log("RETURN STATE:",this.props.returnState) let returnState = this.props.parseAndCleanPath(dataAfterColon) this.props.returnToState(returnState) - } else if(Web3.utils.isAddress(dataSplit[0]) && !isNaN(parseInt(dataSplit[1], 10)) && dataSplit[2]) { + // NOTE: We only need the address and the amount as absolutely necessary + // parts of the QR code scan. `message` is optional. + } else if(Web3.utils.isAddress(dataSplit[0]) && !isNaN(parseInt(dataSplit[1], 10))) { const returnState = { toAddress: dataSplit[0], - amount: parseInt(dataSplit[1], 10), - message: dataSplit[2] + amount: parseInt(dataSplit[1], 10) + } + if (dataSplit.length > 1) { + returnState.message = dataSplit[2] } this.props.returnToState(returnState); } else {