Created
December 25, 2022 01:31
-
-
Save xxiz/14460f5ac567a20dff270edd8386c4c3 to your computer and use it in GitHub Desktop.
fetcher class for useSWR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function fetcher<JSON = any>( | |
input: RequestInfo, | |
init?: RequestInit | |
): Promise<JSON> { | |
const res = await fetch(input, init) | |
return res.json() | |
} | |
export default fetcher; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment