feat: not return to post list after publishing
This commit is contained in:
parent
5d5bb98fa3
commit
6a2fbd1df4
|
|
@ -81,7 +81,7 @@ export default function SubdomainEditor() {
|
|||
page.data ? getPageVisibility(page.data) : PageVisibilityEnum.Draft,
|
||||
)
|
||||
}
|
||||
}, [page.isSuccess])
|
||||
}, [page.isSuccess, page.data])
|
||||
|
||||
const uploadFile = useUploadFile()
|
||||
|
||||
|
|
@ -171,9 +171,19 @@ export default function SubdomainEditor() {
|
|||
if (draftKey) {
|
||||
delStorage(draftKey)
|
||||
queryClient.invalidateQueries(["getPagesBySite", subdomain])
|
||||
queryClient.invalidateQueries(["getPage", draftKey])
|
||||
queryClient.invalidateQueries([
|
||||
"getPage",
|
||||
draftKey.replace(`draft-${subdomain}-`, ""),
|
||||
])
|
||||
} else {
|
||||
queryClient.invalidateQueries(["getPage", pageId])
|
||||
}
|
||||
|
||||
if (createOrUpdatePage.data.data) {
|
||||
router.replace(
|
||||
`/dashboard/${subdomain}/editor?id=${site.data?.metadata?.proof}-${createOrUpdatePage.data.data}&type=${router.query.type}`,
|
||||
)
|
||||
}
|
||||
router.push(`/dashboard/${subdomain}/${isPost ? "posts" : "pages"}`)
|
||||
} else {
|
||||
toast.error("Error: " + createOrUpdatePage.data?.message)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export const useGetPagesBySite = (
|
|||
|
||||
export const useGetPage = (input: Parameters<typeof pageModel.getPage>[0]) => {
|
||||
const unidata = useUnidata()
|
||||
return useQuery(["getPage", input.page, input], async () => {
|
||||
return useQuery(["getPage", input.page || input.pageId, input], async () => {
|
||||
if (!input.site || !(input.page || input.pageId)) {
|
||||
return null
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue