harsh-harlequin
harsh-harlequin2mo ago

How do I make a custom request to a url

How do I make a custom request to a url in nextjs + antd + supabase refine setup I need to access and admin APIs for my dashboard for creating user and stuff Any ideas?
13 Replies
stormy-gold
stormy-gold2mo ago
Did you try asking it in #ask-any-question ? Provide more details and bot can help you.
optimistic-gold
optimistic-gold2mo ago
I did but the bit replies with code that isn't valid , the parameters it tells me to change aren't available And my use case is fairly simple, can you help me with it?
stormy-gold
stormy-gold2mo ago
For custom requests, you can use useCustom hook. https://refine.dev/docs/data/hooks/use-custom/ Check the docs here.
useCustom | Refine
useCustom is used to send custom query requests using the Tanstack Query advantages. It is an extended version of TanStack Query's useQuery and not only supports all features of the mutation but also adds some extra features.
stormy-gold
stormy-gold2mo ago
https://refine.dev/docs/data/data-provider/#multiple-data-providers You can use simple-rest data provider additionally to do custom requests. And speccify your data provider in useCustom hook.
Data Provider | Refine
Data provider acts as a data layer for your app, making HTTP requests and encapsulating how the data is retrieved. The methods of these requests are then consumed by Refine via data hooks.
optimistic-gold
optimistic-gold2mo ago
How would I pair it with useForm?
stormy-gold
stormy-gold2mo ago
You need to have create and update methods of data provider for useForm. Do not expect AI to give you fully working example. It's pointing to right direction. I also suggest reading our guides, I'm sure it will help you a lot: https://refine.dev/docs/guides-concepts/general-concepts/
General Concepts | Refine
Refine is an extensible framework designed for rapidly building web applications. It offers a modern, hook-based architecture, a pluggable system of providers, and a robust state management solution. This section provides an overview of the key concepts in Refine.
optimistic-gold
optimistic-gold2mo ago
I actually read the guide thoroughly, but I had an idea that I need to use useForm hook for the forms Coz it gives a lot of the formProps and button props
stormy-gold
stormy-gold2mo ago
Yeah, that's true
optimistic-gold
optimistic-gold2mo ago
But as of now , you told me that I need to use use custom hook for custom request? And then handle all the formProps and all on my own Can't I somehow intercept the useForm request and send it to a url that I prefer?
stormy-gold
stormy-gold2mo ago
you can use useForm, if your data provider has create and update methods.
optimistic-gold
optimistic-gold2mo ago
I understand, but that might not be the case always Could you please answer that
stormy-gold
stormy-gold2mo ago
You can define useForm request in create and update methods in your data provider.
optimistic-gold
optimistic-gold2mo ago
Seems like this is the only way, fine I'll do that only