brahma-trade-widget
Version:
A React component for trade automation within the Brahma ecosystem.
19 lines (16 loc) • 428 B
text/typescript
import { PROD_BASE_URL, STAGING_BASE_URL } from "./constants"
export const getBaseUrl = () => {
if (typeof window !== "undefined") {
const currentURL = new URL(window.location.href)
return currentURL.origin
}
const env = process.env.NODE_ENV
switch (env) {
case "development":
return STAGING_BASE_URL
case "production":
return PROD_BASE_URL
default:
return STAGING_BASE_URL
}
}