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);
};
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);
}
avatarFile.value = await buildFileFromIMedia(editableGroup.value?.avatar);
bannerFile.value = await buildFileFromIMedia(editableGroup.value?.banner);
} catch (e) {
// Catch errors while building media
console.error(e);
}
editableGroup.value = { ...newGroup };
},
{
immediate: true,
}
);
});
const buildVariables = computed(() => {
let avatarObj = {};