From b05c4b4b8267f641429f059738e5ec1e26ac7816 Mon Sep 17 00:00:00 2001 From: Rao <1227431568@qq.com> Date: Sun, 2 Mar 2025 22:25:39 +0800 Subject: [PATCH] rht --- .../my-duty-path/components/MyDutyPathContainer.tsx | 2 +- apps/web/src/components/common/editor/MindEditor.tsx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/web/src/app/main/my-duty-path/components/MyDutyPathContainer.tsx b/apps/web/src/app/main/my-duty-path/components/MyDutyPathContainer.tsx index 0afed2c..4b7f273 100644 --- a/apps/web/src/app/main/my-duty-path/components/MyDutyPathContainer.tsx +++ b/apps/web/src/app/main/my-duty-path/components/MyDutyPathContainer.tsx @@ -15,7 +15,7 @@ export default function MyDutyPathContainer() { pageSize: 12, where: { type: PostType.PATH, - authorId: user.id, + authorId: user?.id, ...termsCondition, ...searchCondition, }, diff --git a/apps/web/src/components/common/editor/MindEditor.tsx b/apps/web/src/components/common/editor/MindEditor.tsx index ddb8537..985e320 100755 --- a/apps/web/src/components/common/editor/MindEditor.tsx +++ b/apps/web/src/components/common/editor/MindEditor.tsx @@ -44,10 +44,12 @@ export default function MindEditor({ id }: { id?: string }) { // }, // { enabled: Boolean(id) } // ); + const canEdit: boolean = useMemo(() => { const isAuth = isAuthenticated && user?.id === post?.author?.id; - return !!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST); + return !id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST); }, [user]); + const navigate = useNavigate(); const { create, update } = usePost(); const { data: taxonomies } = api.taxonomy.getAll.useQuery({ @@ -178,10 +180,12 @@ export default function MindEditor({ id }: { id?: string }) { useEffect(() => { containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`; }, []); - + useEffect(()=>{ + console.log(canEdit,user?.id,post?.author?.id) + }) return (
- {canEdit && taxonomies && ( + {taxonomies && (