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