kaori 3 سال پیش
والد
کامیت
8ce1b298ca
2فایلهای تغییر یافته به همراه4 افزوده شده و 6 حذف شده
  1. 1 3
      packages/app/src/components/PageList/PageListItemL.tsx
  2. 3 3
      packages/app/src/stores/page-redirect.tsx

+ 1 - 3
packages/app/src/components/PageList/PageListItemL.tsx

@@ -156,8 +156,7 @@ const PageListItemLSubstance: ForwardRefRenderFunction<ISelectable, Props> = (pr
 
     const putBackedHandler = async(path) => {
       try {
-        await unlink(path);
-        console.log('unlink', path);
+        await unlink(`/trash${path}`);
       }
       catch (err) {
         toastError(err);
@@ -167,7 +166,6 @@ const PageListItemLSubstance: ForwardRefRenderFunction<ISelectable, Props> = (pr
         onPagePutBacked(path);
       }
     };
-    console.log('aaa');
     openPutBackPageModal({ pageId, path }, { onPutBacked: putBackedHandler });
   }, [onPagePutBacked, openPutBackPageModal, pageData, unlink]);
 

+ 3 - 3
packages/app/src/stores/page-redirect.tsx

@@ -13,14 +13,14 @@ export const useRedirectFrom = (initialData?: string): SWRResponseWithUtils<Redi
   const { data: currentPagePath } = useCurrentPagePath();
   const swrResponse: SWRResponse<string, Error> = useStaticSWR('redirectFrom', initialData);
   const utils = {
-    unlink: async(path?: string) => {
+    unlink: async(pathToUnlink?: string) => {
       if (currentPagePath == null) {
         return;
       }
 
-      const pathToUnlink = currentPagePath === '/trash' ? `/trash${path}` : currentPagePath;
+      const path = pathToUnlink || currentPagePath;
       try {
-        await apiPost('/pages.unlink', { path: pathToUnlink });
+        await apiPost('/pages.unlink', { path });
         swrResponse.mutate('');
       }
       catch (err) {