import appSettings from './app-settings'

/** 拼接业务 REST 路径（相对路径不含前缀斜杠） */
export function buildRestPath(relative = '') {
	const base = appSettings.restPathPrefix.replace(/\/$/, '')
	const tail = String(relative).replace(/^\//, '')
	return tail ? `${base}/${tail}` : base
}

/** 静态资源 CDN 子路径 */
export function buildCdnStaticPath(relative = '') {
	const base = appSettings.cdnStaticAddon.replace(/\/$/, '')
	const tail = String(relative).replace(/^\//, '')
	return tail ? `${base}/${tail}` : base
}
