Skip to content

Instantly share code, notes, and snippets.

@akihisa-shimada
Created December 17, 2021 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akihisa-shimada/3a09d7a33555d18545a570aabe175d4b to your computer and use it in GitHub Desktop.
Save akihisa-shimada/3a09d7a33555d18545a570aabe175d4b to your computer and use it in GitHub Desktop.
const fetcher = async(url: string): Promise<any> => {
const res = await fetch(url).then(res => res.json());
return res;
}
export const getUser = async(): Promise<any> => {
const user = await fetcher('https://example.com/api/user');
return user;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment