This commit is contained in:
Rao 2025-03-02 22:25:39 +08:00
parent d9fcfbc577
commit b05c4b4b82
2 changed files with 8 additions and 4 deletions

View File

@ -15,7 +15,7 @@ export default function MyDutyPathContainer() {
pageSize: 12, pageSize: 12,
where: { where: {
type: PostType.PATH, type: PostType.PATH,
authorId: user.id, authorId: user?.id,
...termsCondition, ...termsCondition,
...searchCondition, ...searchCondition,
}, },

View File

@ -44,10 +44,12 @@ export default function MindEditor({ id }: { id?: string }) {
// }, // },
// { enabled: Boolean(id) } // { enabled: Boolean(id) }
// ); // );
const canEdit: boolean = useMemo(() => { const canEdit: boolean = useMemo(() => {
const isAuth = isAuthenticated && user?.id === post?.author?.id; 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]); }, [user]);
const navigate = useNavigate(); const navigate = useNavigate();
const { create, update } = usePost(); const { create, update } = usePost();
const { data: taxonomies } = api.taxonomy.getAll.useQuery({ const { data: taxonomies } = api.taxonomy.getAll.useQuery({
@ -178,10 +180,12 @@ export default function MindEditor({ id }: { id?: string }) {
useEffect(() => { useEffect(() => {
containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`; containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`;
}, []); }, []);
useEffect(()=>{
console.log(canEdit,user?.id,post?.author?.id)
})
return ( return (
<div className={` flex-col flex `}> <div className={` flex-col flex `}>
{canEdit && taxonomies && ( {taxonomies && (
<Form form={form} className=" bg-white p-4 border-b"> <Form form={form} className=" bg-white p-4 border-b">
<div className="flex items-center justify-between gap-4"> <div className="flex items-center justify-between gap-4">
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">