getToPath output undefined
I defined my component like this way:
import { useGetToPath, useGo } from "@refinedev/core";
import Button from '@mui/material/Button';
export default function CheckButton() {
const getToPath = useGetToPath();
const go = useGo();
return (
<Button
onClick={() => {
const path = getToPath({
resource: "jobs",
action: "show",
meta: {
id: 1,
},
});
console.log("Generated Path:", path);
go({
to: path,
});
}}
>
Check current job
</Button>
);
};
I do have a resource named jobs and the id is 1 and the action is show. But the console logging shows that the generated path is undefined. What's the problem with this?
import { useGetToPath, useGo } from "@refinedev/core";
import Button from '@mui/material/Button';
export default function CheckButton() {
const getToPath = useGetToPath();
const go = useGo();
return (
<Button
onClick={() => {
const path = getToPath({
resource: "jobs",
action: "show",
meta: {
id: 1,
},
});
console.log("Generated Path:", path);
go({
to: path,
});
}}
>
Check current job
</Button>
);
};
I do have a resource named jobs and the id is 1 and the action is show. But the console logging shows that the generated path is undefined. What's the problem with this?
