cors.ts 367 B

12345678910111213141516
  1. import { getClientConfig } from "../config/client";
  2. import { ApiPath, DEFAULT_API_HOST } from "../constant";
  3. export function corsPath(path: string) {
  4. const baseUrl = getClientConfig()?.isApp ? `${DEFAULT_API_HOST}` : "";
  5. if (!path.startsWith("/")) {
  6. path = "/" + path;
  7. }
  8. if (!path.endsWith("/")) {
  9. path += "/";
  10. }
  11. return `${baseUrl}${path}`;
  12. }