Shun Miyazawa 2 лет назад
Родитель
Сommit
3507b92269
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      apps/app/src/components/PageAlert/WipPageAlert.tsx

+ 5 - 3
apps/app/src/components/PageAlert/WipPageAlert.tsx

@@ -14,19 +14,21 @@ export const WipPageAlert = (): JSX.Element => {
   const { trigger: mutateCurrentPage } = useSWRMUTxCurrentPage();
 
   const clickPagePublishButton = useCallback(async() => {
-    if (currentPage?._id == null) {
+    const pageId = currentPage?._id;
+
+    if (pageId == null) {
       return;
     }
 
     try {
-      await publish(currentPage._id);
+      await publish(pageId);
       await mutateCurrentPage();
       toastSuccess(t('wip_page.success_publish_page'));
     }
     catch {
       toastError(t('wip_page.fail_publish_page'));
     }
-  }, [currentPage._id, mutateCurrentPage, t]);
+  }, [currentPage?._id, mutateCurrentPage, t]);
 
 
   if (!currentPage?.wip) {