Skip to content

Instantly share code, notes, and snippets.

@rjpkuyper
Last active February 17, 2023 06:49
Show Gist options
  • Save rjpkuyper/6436a7afc2a0ef37e20683374a2a60a5 to your computer and use it in GitHub Desktop.
Save rjpkuyper/6436a7afc2a0ef37e20683374a2a60a5 to your computer and use it in GitHub Desktop.
export enum Paths {
PRODUCTS = '/products'
}
export const createUrl = (path: Paths, url = process.env.BASE_URL) => `${url}${path}`
export const getProducts = (
httpGet = fetch,
url: string = createUrl(Paths.PRODUCTS),
) => httpGet(url).then(e => e.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment