From 760cef355123cc058f4249fad6d663eae2e0ef3a Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 23 Oct 2024 03:08:44 +0200 Subject: [PATCH] Fixed actor edit page breaking if no avatar is available. --- pages/actors/@actorId/edit/+Page.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pages/actors/@actorId/edit/+Page.vue b/pages/actors/@actorId/edit/+Page.vue index bd48351..e3f52d7 100644 --- a/pages/actors/@actorId/edit/+Page.vue +++ b/pages/actors/@actorId/edit/+Page.vue @@ -638,13 +638,15 @@ const bustSizes = { bustSizes.uk = bustSizes.us; bustSizes.jp = bustSizes.eu; +const avatars = Object.values(Object.fromEntries(actor.value.profiles.filter((profile) => !!profile.avatar).map((profile) => [profile.avatar.id, profile.avatar]))); + const fields = computed(() => [ - { + ...(avatars.length > 0 ? [{ key: 'avatar', type: 'avatar', - value: actor.value.avatar.id, - options: Object.values(Object.fromEntries(actor.value.profiles.filter((profile) => !!profile.avatar).map((profile) => [profile.avatar.id, profile.avatar]))), - }, + value: actor.value.avatar?.id, + options: avatars, + }] : []), ...(user.role === 'admin' ? [{ key: 'name',