Replies: 1 comment 3 replies
-
queryFn: async () => {
try {
const response = await axios.get(`https://dummyjson.com/products/1`);
return response.data;
} catch (exception) {
return exception;
}
} You could try something like this, of course you'll have to take care of the types. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Since there is no way for me to specify the type of error thrown in typescript, I was wondering if it'd be possible to have my queryFn return { type: 'success', data: S } | { type: 'failure', data: F }. There could even be a isSuccess config that would be result => result.type === 'success'.
Beta Was this translation helpful? Give feedback.
All reactions