mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
Clear cached data after publishing.
This commit is contained in:
@@ -8,6 +8,7 @@ import showToast from "../components/toast.ts";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { app } from "../app.ts";
|
import { app } from "../app.ts";
|
||||||
import { ErrorAlert } from "../components/alert.tsx";
|
import { ErrorAlert } from "../components/alert.tsx";
|
||||||
|
import {useAppContext} from "../components/AppContext.tsx";
|
||||||
|
|
||||||
export default function PublishPage() {
|
export default function PublishPage() {
|
||||||
const [title, setTitle] = useState<string>("")
|
const [title, setTitle] = useState<string>("")
|
||||||
@@ -22,6 +23,8 @@ export default function PublishPage() {
|
|||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const appContext = useAppContext()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
document.title = t("Publish Resource");
|
document.title = t("Publish Resource");
|
||||||
}, [t])
|
}, [t])
|
||||||
@@ -57,6 +60,7 @@ export default function PublishPage() {
|
|||||||
})
|
})
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setSubmitting(false)
|
setSubmitting(false)
|
||||||
|
appContext.clear();
|
||||||
navigate("/resources/" + res.data!, { replace: true })
|
navigate("/resources/" + res.data!, { replace: true })
|
||||||
} else {
|
} else {
|
||||||
setSubmitting(false)
|
setSubmitting(false)
|
||||||
|
Reference in New Issue
Block a user