UNPKG

cra-template-pi

Version:

A quick start Create React App with many auto implemented features

20 lines (17 loc) 550 B
import apiPaths from '../../src/api/apiPaths' /** * Returns the concatenated api paths, having auto complete * @param paths */ export const getExactPath = (...paths: (keyof typeof apiPaths | string)[]) => `**${paths .map((path) => path in apiPaths ? apiPaths[path as keyof typeof apiPaths] : `/${path}` ) .join('')}` /** * Returns the path built with api/v1 and matching other query params * @param paths */ export const getMatchingPath = (...paths: (keyof typeof apiPaths | string)[]) => `${getExactPath(...paths)}?**`