Created
October 13, 2021 04:39
-
-
Save devmnj/46f4d27d5f2f6e3131a9b4a689ca31b4 to your computer and use it in GitHub Desktop.
Type Script Fetcher (API) for SWR
This file contains hidden or 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
export default async function fetcher<JSON = any>( | |
input: RequestInfo, | |
init?: RequestInit | |
): Promise<JSON> { | |
const res = await fetch(input, init) | |
return res.json() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment