like-gold
like-gold4w 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
exotic-emerald
exotic-emerald3w ago
Did you try asking it in #ask-any-question ? Provide more details and bot can help you.
stormy-gold
stormy-gold3w 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?
exotic-emerald
exotic-emerald3w 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.
exotic-emerald
exotic-emerald3w 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.
stormy-gold
stormy-gold3w ago
How would I pair it with useForm?
exotic-emerald
exotic-emerald3w 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.
stormy-gold
stormy-gold3w 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
exotic-emerald
exotic-emerald3w ago
Yeah, that's true
stormy-gold
stormy-gold3w 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?
exotic-emerald
exotic-emerald3w ago
you can use useForm, if your data provider has create and update methods.
stormy-gold
stormy-gold3w ago
I understand, but that might not be the case always Could you please answer that
exotic-emerald
exotic-emerald3w ago
You can define useForm request in create and update methods in your data provider.
stormy-gold
stormy-gold3w ago
Seems like this is the only way, fine I'll do that only