import React from 'react' import { type Meta } from '@storybook/react-vite' import { getApiUrlPrefix } from '../../services/apiEndpointHelpers' import { DocsTemplate } from '../../../.storybook' export const Example = (): React.JSX.Element => { const apiUrl = getApiUrlPrefix() const customBackendUrl = getApiUrlPrefix('custom-backend') // Example with custom configuration const customMappingUrl = getApiUrlPrefix('api', { customMappings: { development: '/local-{backend}', production: '/prod-{backend}', }, }) // Example with environment override const overrideUrl = getApiUrlPrefix('service', { customEnvironmentName: 'development', }) return (
Default backend URL prefix: {apiUrl}
Custom backend URL prefix: {customBackendUrl}
Custom mapping example: {customMappingUrl}
Environment override example: {overrideUrl}
development: Returns{' '}
/staging-{`{backendName}`}
stage: Returns{' '}
/staging-{`{backendName}`}
demo: Returns{' '}
/demo-{`{backendName}`}
production: Returns{' '}
/{`{backendName}`}
customMappings: Override URL patterns for
specific environments using {`{backend}`}{' '}
placeholder
customEnvironmentName: Force a specific
environment regardless of detection
environmentConfig: Pass custom environment
detection logic and fallback settings
localBackendOverride:{`{backendName}`}