ai-chatbot/apps/editor/lib/pascal-base-path.ts
134 c3faeba1c8 Squashed 'services/pascal-editor/' content from commit 312064e6
git-subtree-dir: services/pascal-editor
git-subtree-split: 312064e6e8122f958d2961e28ea85ad8b9db40c5
2026-07-12 00:43:59 +08:00

11 lines
368 B
TypeScript

const configuredBasePath = process.env.NEXT_PUBLIC_PASCAL_BASE_PATH?.trim() ?? ''
export const PASCAL_BASE_PATH = configuredBasePath
? `/${configuredBasePath.replace(/^\/+|\/+$/g, '')}`
: ''
export function withPascalBasePath(pathname: string): string {
const path = pathname.startsWith('/') ? pathname : `/${pathname}`
return `${PASCAL_BASE_PATH}${path}`
}