Fix handling of users without userId

This commit is contained in:
Yarmo Mackenbach 2020-12-26 14:08:21 +01:00
parent a8389bd0b6
commit 8a5ce08c00

View file

@ -151,15 +151,15 @@ const process = (publicKey) => {
users.forEach((user, i) => { users.forEach((user, i) => {
usersOutput[i] = { usersOutput[i] = {
userData: { userData: {
id: user.userId.userid, id: user.userId ? user.userId.userid : null,
name: user.userId.name, name: user.userId ? user.userId.name : null,
email: user.userId.email, email: user.userId ? user.userId.email : null,
comment: user.userId.comment, comment: user.userId ? user.userId.comment : null,
isPrimary: primaryUser.index === i, isPrimary: primaryUser.index === i,
}, },
} }
if ('selfCertifications' in user && user.selfCertifications.length >= 0) { if ('selfCertifications' in user && user.selfCertifications.length > 0) {
const notations = user.selfCertifications[0].rawNotations const notations = user.selfCertifications[0].rawNotations
usersOutput[i].notations = notations.map( usersOutput[i].notations = notations.map(
({ name, value, humanReadable }) => { ({ name, value, humanReadable }) => {