Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the error when saving settings for posts in the uc #5370

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions ui/uc-src/modules/contents/posts/PostEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,7 @@ const name = useRouteQuery<string | undefined>("name");

onMounted(async () => {
if (name.value) {
const { data: post } = await apiClient.uc.post.getMyPost({
name: name.value,
});

formState.value = post;

await getLatestPost();
await handleFetchContent();
handleResetCache();
return;
Expand Down Expand Up @@ -189,6 +184,17 @@ useAutoSaveContent(currentCache, toRef(content.value, "raw"), async () => {
}
});

async function getLatestPost() {
if (!name.value) {
return;
}
const { data: latestPost } = await apiClient.uc.post.getMyPost({
name: name.value,
});

formState.value = latestPost;
}

/**
* Fetch content from the head snapshot.
*/
Expand Down Expand Up @@ -374,6 +380,7 @@ const postSettingEditModal = ref(false);

function handleOpenPostSettingEditModal() {
handleSave({ mute: true });
getLatestPost();
LIlGG marked this conversation as resolved.
Show resolved Hide resolved
postSettingEditModal.value = true;
}

Expand Down
Loading