I am learning restful-react and trying to use the useMutate
feature as a POST request but I need to include a payload. I see in the documentation there is the options to mock data to the console but Im not sure of how I can I actually include the data to send to the backend?
this is an example of my request:
const { mutate: hitLogger } = useMutate({
path: API_URL_LOGGER,
verb: 'POST',
requestOptions: {
headers: {
...API_BASE_HEADERS,
Authorization: `Bearer ${userToken}`,
},
},
mock: {
error: error,
},
})
useEffect(() => {
if(error){
hitLogger()
}
}, [error])
Do I need to send the error as a param to the hitLogger function?