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,
where: {
type: PostType.PATH,
authorId: user.id,
authorId: user?.id,
...termsCondition,
...searchCondition,
},

View File

@ -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 (
<div className={` flex-col flex `}>
{canEdit && taxonomies && (
{taxonomies && (
<Form form={form} className=" bg-white p-4 border-b">
<div className="flex items-center justify-between gap-4">
<div className="flex items-center gap-4">