forked from potsda.mn/mobilizon
post data are correctly restored when editing
This commit is contained in:
parent
04ee634594
commit
66280a07e6
|
@ -195,6 +195,10 @@ onMounted(async () => {
|
||||||
pictureFile.value = await buildFileFromIMedia(post.value?.picture);
|
pictureFile.value = await buildFileFromIMedia(post.value?.picture);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This is useful when post data is already cached from the API during navigation inside the app
|
||||||
|
editablePost.value = { ...editablePost.value, ...post.value };
|
||||||
|
|
||||||
|
// This watch() function is useful when post data loads directly from the API upon page load
|
||||||
watch(post, async (newPost: IPost | undefined, oldPost: IPost | undefined) => {
|
watch(post, async (newPost: IPost | undefined, oldPost: IPost | undefined) => {
|
||||||
if (oldPost?.picture !== newPost?.picture) {
|
if (oldPost?.picture !== newPost?.picture) {
|
||||||
pictureFile.value = await buildFileFromIMedia(post.value?.picture);
|
pictureFile.value = await buildFileFromIMedia(post.value?.picture);
|
||||||
|
|
Loading…
Reference in a new issue