From 30942a658041d6f8eb73c23ab6a611afee5108d6 Mon Sep 17 00:00:00 2001 From: Simon Madine Date: Fri, 25 May 2018 15:54:43 +0100 Subject: [PATCH] Check the user is set before filtering transfers This solves issue #11. The error is thrown on load because the user is only set after the dropdown value has changed. This doesn't attempt to filter the transfers if the user hasn't been set. Signed-off-by: Simon Madine --- LFS171x/sawtooth-material/sawtooth-tuna/client/src/app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/LFS171x/sawtooth-material/sawtooth-tuna/client/src/app.js b/LFS171x/sawtooth-material/sawtooth-tuna/client/src/app.js index a356c539..71808748 100644 --- a/LFS171x/sawtooth-material/sawtooth-tuna/client/src/app.js +++ b/LFS171x/sawtooth-material/sawtooth-tuna/client/src/app.js @@ -49,9 +49,11 @@ app.refresh = function () { } }) - // Populate transfer list for selected user - transfers.filter(transfer => transfer.owner === this.user.public) - .forEach(transfer => addAction('#transferList', transfer.asset, 'Accept')) + // Populate transfer list for selected user (if there is a selected user) + if(this.user) { + transfers.filter(transfer => transfer.owner === this.user.public) + .forEach(transfer => addAction('#transferList', transfer.asset, 'Accept')) + } // Populate transfer select with both local and blockchain keys let publicKeys = this.keys.map(pair => pair.public)