diff --git a/src/hooks/usePublish.js b/src/hooks/usePublish.js index e8b7cd00..3bfc935f 100644 --- a/src/hooks/usePublish.js +++ b/src/hooks/usePublish.js @@ -23,6 +23,7 @@ export const usePublish = (props) => { const { verify } = useVerifyToken(); const navigateTo = useNavigate(); const { t } = useTranslation(["publish", "translation"]); + const dataBase = "publish"; const [isLoading, setIsLoading] = useState(false); const [isOk, setIsOk] = useState(false); @@ -63,18 +64,18 @@ export const usePublish = (props) => { if (!changeId && res.status === 0) { // 创建 cancel(); + clearDataBase(dataBase) createLoading = false; setCreateLoading(createLoading); message.success(t("message.success.create")); - localStorage.removeItem("decert.store"); navigateTo(`/quests/${createTokenId}`) }else if (res.data.uri === ("ipfs://"+jsonHash)){ // 修改 cancel(); + clearDataBase(dataBase) createLoading = false; setCreateLoading(createLoading); message.success(t("translation:message.success.save")); - localStorage.removeItem("decert.store"); navigateTo(`/quests/${changeId}`); } }) diff --git a/src/views/Publish/index.js b/src/views/Publish/index.js index 656dcc92..b4a369b6 100644 --- a/src/views/Publish/index.js +++ b/src/views/Publish/index.js @@ -124,6 +124,7 @@ export default function Publish(params) { recommend: publishObj.recommend, category: publishObj.category }).then(res => { + clearDataBase(dataBase) res?.message && message.success(res?.message); !res && setLoading(false); return res