Improve error message

This commit is contained in:
Yarmo Mackenbach 2022-10-11 15:19:14 +02:00
parent b2b1a1a8d0
commit fe8520b40f
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1

View file

@ -40,6 +40,22 @@ block content
} }
} }
if (data && 'errors' in data && data.errors.length > 0)
section
h2 Something went wrong while viewing the profile
.card
if data.errors.length === 1
p The following error was reported:
else
p The following errors were reported:
ul
each error in data.errors
li
p= error
p Please see the
a(href="https://docs.keyoxide.org/getting-started/something-went-wrong/") documentation
| for help.
else
section.profile.narrow.h-card section.profile.narrow.h-card
noscript noscript
p Keyoxide requires JavaScript to function. p Keyoxide requires JavaScript to function.
@ -86,13 +102,6 @@ block content
textarea#signature(name='signature')= signature textarea#signature(name='signature')= signature
input(type='submit', name='submit', value='Generate profile') input(type='submit', name='submit', value='Generate profile')
if (data && 'errors' in data && data.errors.length > 0)
h2 Something went wrong while generating the profile
ul
each error in data.errors
li= error
else
unless (isSignature && !signature) unless (isSignature && !signature)
#profileHeader.card.card--transparent.card--profileHeader #profileHeader.card.card--transparent.card--profileHeader
img#profileAvatar.u-logo(src=data.extra.avatarURL alt="avatar") img#profileAvatar.u-logo(src=data.extra.avatarURL alt="avatar")