1.1.1 • Published 11 months ago
react-query-key-helper v1.1.1
Installing
For the latest stable version:
npm install react-query-key-helper
Usage
createQueryOption<Payload, PathVariables, Response> => ((
payload: Payload,
pathVariables?: PathVariables
) => QueryKeyHelperReturn<Response>
- post method
createQueryOption({
apiUrl: () => "/todos/search",
queryFn: (apiUrl, payload: TeamSearchRequestT) =>
request.post < PagedTeamsResponseT > (apiUrl, payload),
});
- get method
createQueryOption<undefined, { id: string }>({
apiUrl: ({ id }) => `/todo/${id}`,
queryFn: (apiUrl) => request.get < TeamResponseT > apiUrl,
});