init
This commit is contained in:
16
frontend/admin/src/tenant.ts
Normal file
16
frontend/admin/src/tenant.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export function getTenantCodeFromPath(pathname = window.location.pathname): string {
|
||||
const parts = pathname.split('/').filter(Boolean)
|
||||
if (parts.length < 2 || parts[0] !== 't') return ''
|
||||
return decodeURIComponent(parts[1] || '').toLowerCase()
|
||||
}
|
||||
|
||||
export function getAdminRouterBase(pathname = window.location.pathname): string {
|
||||
const tenantCode = getTenantCodeFromPath(pathname)
|
||||
return `/t/${tenantCode}/admin/`
|
||||
}
|
||||
|
||||
export function getApiBaseURL(pathname = window.location.pathname): string {
|
||||
const tenantCode = getTenantCodeFromPath(pathname)
|
||||
return `/t/${tenantCode}/v1`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user