From 8123610c7bd304d347a53fd5fc861f1eec53242e Mon Sep 17 00:00:00 2001 From: Franklin Volcic <59806465+fvolcic@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:16:36 -0500 Subject: [PATCH] Fix data-sdk to support local development on production (#192) Co-authored-by: Franklin --- packages/data-sdk/src/config/whichFormantApiUrl.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/data-sdk/src/config/whichFormantApiUrl.ts b/packages/data-sdk/src/config/whichFormantApiUrl.ts index b1c46917..8656ebfc 100644 --- a/packages/data-sdk/src/config/whichFormantApiUrl.ts +++ b/packages/data-sdk/src/config/whichFormantApiUrl.ts @@ -15,7 +15,7 @@ export function whichFormantApiUrl( if (urlParams.get("formant_prod")) { return "https://api.formant.io"; } - + if (urlParams.get("formant_stage")) { return "https://api-stage.formant.io"; } @@ -40,7 +40,17 @@ export function whichFormantApiUrl( } } } - } catch (_) {} + + if (host) { + if (host.includes("app-dev.formant.io") || host.includes("localhost")) { + return "https://api-dev.formant.io"; + } else if (host.includes("app-stage.formant.io")) { + return "https://api-stage.formant.io"; + } else if (host.includes("app.formant.io")) { + return "https://api.formant.io"; + } + } + } catch (_) { } if (host) { if (host.includes("app-dev.formant.io")) {