Improve navigation logic after publishing content (#7775)

pull/7762/head^2
Ryan Wang 2025-09-20 23:35:36 +08:00 committed by GitHub
parent ba23e6c07b
commit 6bc81a9866
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View File

@ -220,9 +220,15 @@ const handlePublish = async () => {
});
if (returnToView.value && permalink) {
handleClearCache(routeQueryName.value);
window.location.href = permalink;
} else {
return;
}
if (router.options.history.state.back === null) {
router.push({ name: "SinglePages" });
} else {
router.back();
}
} else {
formState.value.page.spec.publish = true;
@ -237,7 +243,7 @@ const handlePublish = async () => {
}
Toast.success(t("core.common.toast.publish_success"));
handleClearCache(routeQueryName.value as string);
handleClearCache(routeQueryName.value);
} catch (error) {
console.error("Failed to publish single page", error);
Toast.error(t("core.common.toast.publish_failed_and_retry"));

View File

@ -262,9 +262,15 @@ const handlePublish = async () => {
});
if (returnToView.value === "true" && permalink) {
handleClearCache(name.value);
window.location.href = permalink;
} else {
return;
}
if (router.options.history.state.back === null) {
router.push({ name: "Posts" });
} else {
router.back();
}
} else {
const { data } = await consoleApiClient.content.post.draftPost({