interface FileItem { to?: string label?: string icon?: string target?: string } const baseUrl = `https://ewr1.vultrobjects.com/lgcc-` export const isAbsoluteUrl = (url?: string) => { if (!url) return false return /^https?:\/\//i.test(url) } export const buildUrl = ( file: FileItem, type?: string ) => { if (!file?.to) return '#' if (isAbsoluteUrl(file.to)) { return file.to } if (!type) { return `${baseUrl}${file.to}` } return `${baseUrl}${type}/${file.to}` }