-
Problem SpaceMost API's often include A REST endpoint used to query the data often differs from the endpoint used to patch/delete/post data. (While get routes can be also hidden from public API) Let's say I need to fetch a user at Get: So you give a resource to useForm: const {
formProps,
mutationResult,
show
} = useForm<TData, TError, TUpdates>({
action: 'edit',
resource: `Public/User/${showId as string}`,
// mutation needs to happen at Internal/User/${showId as string}
queryOptions: {
enabled: Boolean(showId)
},
}) But then useMutation uses the same route to Any advice on how to deal with such situations? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @vinclou , |
Beta Was this translation helpful? Give feedback.
Hey @vinclou ,
I don't know how common this use-case is but you can deal with this using data hooks. Override your form's onSubmit and call your desired data hook (
useUpdate
,useCreate
, etc.). For data store invalidation, you can use useInvalidate. I hope it will be useful for you 💥