Finalize Typescript restructure

This commit is contained in:
Darko Gjorgjijoski
2026-04-06 17:59:15 +02:00
parent cab785172e
commit 74b4b2df4e
209 changed files with 12419 additions and 1745 deletions

View File

@@ -0,0 +1,41 @@
import type { RouteParamValue } from 'vue-router'
export function resolveCompanySlug(
companyParam: RouteParamValue | RouteParamValue[] | undefined
): string {
if (Array.isArray(companyParam)) {
return companyParam[0] ?? ''
}
return companyParam ?? ''
}
export function buildCustomerPortalPath(
companySlug: string,
path: string = ''
): string {
const normalizedPath = path.replace(/^\/+/, '')
if (!normalizedPath) {
return `/${companySlug}/customer`
}
return `/${companySlug}/customer/${normalizedPath}`
}
export function prefixCustomerPortalMenuLink(
companySlug: string,
link: string
): string {
const normalizedLink = link.replace(/^\/+/, '')
if (normalizedLink === 'customer') {
return `/${companySlug}/customer`
}
if (normalizedLink.startsWith('customer/')) {
return `/${companySlug}/${normalizedLink}`
}
return buildCustomerPortalPath(companySlug, normalizedLink)
}