From 20b4aaabc97080e85cb68fd03393379c7ef82d95 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 30 May 2023 08:48:26 +0200 Subject: [PATCH] fix(front): fix showing current group avatar & banners Signed-off-by: Thomas Citharel --- js/src/views/Group/GroupSettings.vue | 39 +++++++--------------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/js/src/views/Group/GroupSettings.vue b/js/src/views/Group/GroupSettings.vue index a82657756..7d17e283b 100644 --- a/js/src/views/Group/GroupSettings.vue +++ b/js/src/views/Group/GroupSettings.vue @@ -262,38 +262,17 @@ const copyURL = async (): Promise => { }, 2000); }; -onGroupResult(({ data }) => { +onGroupResult(async ({ data }) => { + if (!data) return; editableGroup.value = data.group; -}); - -watch( - group, - async (newGroup: IGroup | undefined, oldGroup: IGroup | undefined) => { - console.debug("watching group"); - if (!newGroup) return; - try { - if ( - oldGroup?.avatar !== undefined && - oldGroup?.avatar !== newGroup?.avatar - ) { - avatarFile.value = await buildFileFromIMedia(newGroup?.avatar); - } - if ( - oldGroup?.banner !== undefined && - oldGroup?.banner !== newGroup?.banner - ) { - bannerFile.value = await buildFileFromIMedia(newGroup?.banner); - } - } catch (e) { - // Catch errors while building media - console.error(e); - } - editableGroup.value = { ...newGroup }; - }, - { - immediate: true, + try { + avatarFile.value = await buildFileFromIMedia(editableGroup.value?.avatar); + bannerFile.value = await buildFileFromIMedia(editableGroup.value?.banner); + } catch (e) { + // Catch errors while building media + console.error(e); } -); +}); const buildVariables = computed(() => { let avatarObj = {};