ordinary-sapphireO
Refine8mo ago
5 replies
ordinary-sapphire

how to pass custom params to access control of show page

I am using antdesign and nextjs. I have a show page like this
"use client";

import { Show } from "@refinedev/antd";
import { CanAccess, useParsed, useShow } from "@refinedev/core";
import { Typography } from "antd";
import { useParams } from "next/navigation";
import { useCompany } from "src/hooks/use-company";
import { Job } from "src/types/job.type";

export default function JobShow() {
  const { id } = useParsed();
  const companyId = useCompany();
  const { query } = useShow<Job>({
    resource: "job",
    id,
    meta: {
      companyId,
    },
  });

  return (
    <Show>
      <Typography.Title>{query.data?.data.title}</Typography.Title>
      <Typography.Paragraph>{query.data?.data.description}</Typography.Paragraph>
    </Show>
  );
}

But from here how can i pass companyId to accesscontrol provider params?
Was this page helpful?