Change the url for a resource for get data from different API version

I had this code and I want to use the useTable hook and configure to get the resourse using a V2 version of the API The result of this code is something like "http://api/v1/v2/entity/id"
const { tableProps, setCurrent, setFilters, pageSize, setPageSize } = useTable({
resource: `v2/entity/${id}`,
});
const { tableProps, setCurrent, setFilters, pageSize, setPageSize } = useTable({
resource: `v2/entity/${id}`,
});
2 Replies
kapa.ai
kapa.ai5w ago
Hi @Sebastos. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To change the URL for a resource to get data from a different API version using the useTable hook, you can specify the resource property with the desired API version. In your case, you want to use the V2 version of the API. Here is how you can modify your code to achieve this:
const { tableProps, setCurrent, setFilters, pageSize, setPageSize } = useTable({
resource: `v2/entity/${id}`,
});
const { tableProps, setCurrent, setFilters, pageSize, setPageSize } = useTable({
resource: `v2/entity/${id}`,
});
This will configure the useTable hook to fetch data from the specified V2 version of the API. For more details, you can refer to the useTable documentation (https://refine.dev/docs/data/hooks/use-table/#dataprovidername). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5w ago
<@689846866837373077> kapa.ai is still learning and improving, please let us know how it did by reacting below