mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 21:29:08 +03:00
19 lines
584 B
TypeScript
19 lines
584 B
TypeScript
export function getPathnameWithoutQuery(asPath?: string, fallback?: string): string {
|
|
const path = asPath ?? fallback ?? ''
|
|
if (typeof path !== 'string' || path.length === 0) return ''
|
|
|
|
const withoutQuery = path.split('?')[0]
|
|
return withoutQuery ?? path
|
|
}
|
|
|
|
export function isOrgMenuScope(pathname: string): boolean {
|
|
if (!pathname || typeof pathname !== 'string') return false
|
|
const trimmed = pathname.trim()
|
|
return (
|
|
trimmed.startsWith('/org/') ||
|
|
trimmed === '/v2/org' ||
|
|
trimmed.startsWith('/v2/org/') ||
|
|
trimmed.startsWith('/v2/organizations')
|
|
)
|
|
}
|