You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a mutation which returns a Content-Disposition header with the filename, etc. But my generated mutation returns only a string, any way to get access to the response headers? Thanks for the great package!
The text was updated successfully, but these errors were encountered:
The mutations generated by this library do not return headers. Instead of using the generated mutation hook, create your own hook.
The following is an example using the axios client. (The problem is that the types generated by the Hey API do not have headers, though.)
import{addPet}from"../openapi/requests/services.gen";import{AddPetMutationResult,UseFindPetsKeyFn,}from"../openapi/queries";import{AxiosError}from"axios";import{AddPetData,AddPetError}from"../openapi/requests/types.gen";// create your own hookconst{ mutate, isError }=useMutation<AddPetMutationResult,AxiosError<AddPetError>,AddPetData>({mutationKey: [useAddPetKey],mutationFn: (options)=>addPet(options),});// mutationmutate({body: {name: text},},{onSuccess: (data)=>{constcontentDisposition=data.headers["content-disposition"];// do something},});
I have a mutation which returns a Content-Disposition header with the filename, etc. But my generated mutation returns only a string, any way to get access to the response headers? Thanks for the great package!
The text was updated successfully, but these errors were encountered: