mirror of https://github.com/halo-dev/halo
Improve navigation logic after publishing content (#7775)
parent
ba23e6c07b
commit
6bc81a9866
|
@ -220,9 +220,15 @@ const handlePublish = async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (returnToView.value && permalink) {
|
if (returnToView.value && permalink) {
|
||||||
|
handleClearCache(routeQueryName.value);
|
||||||
window.location.href = permalink;
|
window.location.href = permalink;
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (router.options.history.state.back === null) {
|
||||||
router.push({ name: "SinglePages" });
|
router.push({ name: "SinglePages" });
|
||||||
|
} else {
|
||||||
|
router.back();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
formState.value.page.spec.publish = true;
|
formState.value.page.spec.publish = true;
|
||||||
|
@ -237,7 +243,7 @@ const handlePublish = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.success(t("core.common.toast.publish_success"));
|
Toast.success(t("core.common.toast.publish_success"));
|
||||||
handleClearCache(routeQueryName.value as string);
|
handleClearCache(routeQueryName.value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to publish single page", error);
|
console.error("Failed to publish single page", error);
|
||||||
Toast.error(t("core.common.toast.publish_failed_and_retry"));
|
Toast.error(t("core.common.toast.publish_failed_and_retry"));
|
||||||
|
|
|
@ -262,9 +262,15 @@ const handlePublish = async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (returnToView.value === "true" && permalink) {
|
if (returnToView.value === "true" && permalink) {
|
||||||
|
handleClearCache(name.value);
|
||||||
window.location.href = permalink;
|
window.location.href = permalink;
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (router.options.history.state.back === null) {
|
||||||
router.push({ name: "Posts" });
|
router.push({ name: "Posts" });
|
||||||
|
} else {
|
||||||
|
router.back();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const { data } = await consoleApiClient.content.post.draftPost({
|
const { data } = await consoleApiClient.content.post.draftPost({
|
||||||
|
|
Loading…
Reference in New Issue