Last active
February 17, 2023 06:49
-
-
Save rjpkuyper/6436a7afc2a0ef37e20683374a2a60a5 to your computer and use it in GitHub Desktop.
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 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