Spaces:
Running
Running
File size: 609 Bytes
dd87944 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /** Base path for GitHub Pages (/emo-online) or "" locally */
export const PUBLIC_BASE = (process.env.PUBLIC_URL || "").replace(/\/$/, "");
/** React Router basename */
export const ROUTER_BASENAME = PUBLIC_BASE || undefined;
/** Build an app path with optional GH Pages prefix */
export function appPath(path) {
const p = path.startsWith("/") ? path : `/${path}`;
return `${PUBLIC_BASE}${p}`;
}
/** Full browser URL for OAuth callbacks etc. */
export function frontendUrl(path = "/") {
const origin = window.location.origin.replace("localhost", "127.0.0.1");
return `${origin}${appPath(path)}`;
}
|