Commit ce3e704b authored by Marek Kotewicz's avatar Marek Kotewicz
Browse files

Special error message, when no accounts are set up, closes #74

parent 886cb496
......@@ -70,6 +70,10 @@ function findAccountWithAddress (getState, address) {
})
}
function hasAccounts (getState) {
return getState().accounts.all.length != 0
}
export function scannerDispatch (data) {
return async function (dispatch, getState) {
if (!getState().scanner.scannerEnabled) {
......@@ -78,10 +82,15 @@ export function scannerDispatch (data) {
dispatch(disableScanner())
try {
if (!hasAccounts(getState)) {
dispatch(displayScannerWarning('No accounts found'))
return
}
let txRequest = JSON.parse(data)
let account = findAccountWithAddress(getState, txRequest.data.account)
if (!account) {
dispatch(displayScannerWarning('Invalid sender address ' + txRequest.data.account))
dispatch(displayScannerWarning('You are not able to sign transaction X from ' + txRequest.data.account))
return
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment