Created
August 27, 2021 08:32
-
-
Save chizhovdee/0014fd91ac7f012a943be7ed20dfad66 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 const API = { | |
getDirections: 'getDirections', | |
// others | |
} | |
const stringifyQuery = (query) => !isEmpty(query) ? `?${qs.stringify(query)}` : '' | |
const API_URLS = { | |
[API.getDirections]: (params, query) => `${__DOMAIN__}/backend/api/directions/${params.direction}${stringifyQuery(query)}` | |
} | |
export const getApiUrl = (apiKey, params, query) => API_URLS[apiKey](params, query) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment