fix(front): fix showing current group avatar & banners

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-05-30 08:48:26 +02:00
parent 02867e6e14
commit 20b4aaabc9
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -262,38 +262,17 @@ const copyURL = async (): Promise<void> => {
}, 2000); }, 2000);
}; };
onGroupResult(({ data }) => { onGroupResult(async ({ data }) => {
if (!data) return;
editableGroup.value = data.group; editableGroup.value = data.group;
}); try {
avatarFile.value = await buildFileFromIMedia(editableGroup.value?.avatar);
watch( bannerFile.value = await buildFileFromIMedia(editableGroup.value?.banner);
group, } catch (e) {
async (newGroup: IGroup | undefined, oldGroup: IGroup | undefined) => { // Catch errors while building media
console.debug("watching group"); console.error(e);
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,
} }
); });
const buildVariables = computed(() => { const buildVariables = computed(() => {
let avatarObj = {}; let avatarObj = {};