fix signin signout and apply the new style
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
const DASHBOARD_BASE_PATH = '/dashboard'
|
||||
|
||||
export function toDashboardAppPath(path?: string | null): string {
|
||||
const value = (path ?? '').trim()
|
||||
if (!value || value === '/') return '/'
|
||||
|
||||
let normalized = value.startsWith('/') ? value : `/${value}`
|
||||
|
||||
while (normalized === DASHBOARD_BASE_PATH || normalized.startsWith(`${DASHBOARD_BASE_PATH}/`)) {
|
||||
normalized = normalized.slice(DASHBOARD_BASE_PATH.length) || '/'
|
||||
}
|
||||
|
||||
return normalized
|
||||
}
|
||||
|
||||
export function toPublicDashboardPath(path?: string | null): string {
|
||||
const appPath = toDashboardAppPath(path)
|
||||
return appPath === '/' ? DASHBOARD_BASE_PATH : `${DASHBOARD_BASE_PATH}${appPath}`
|
||||
}
|
||||
Reference in New Issue
Block a user