[READ-ONLY] a fast, modern browser for the npm registry

fix: set `org` to empty string to make sure its route param is omitted (#1126)

authored by

山吹色御守 and committed by
GitHub
29d1ac02 3256342b

+6 -4
+6 -4
app/utils/router.ts
··· 1 - export function packageRoute(packageName: string, version?: string | null) { 2 - const [org, name] = packageName.startsWith('@') ? packageName.split('/') : [null, packageName] 1 + import type { RouteLocationRaw } from 'vue-router' 2 + 3 + export function packageRoute(packageName: string, version?: string | null): RouteLocationRaw { 4 + const [org, name = ''] = packageName.startsWith('@') ? packageName.split('/') : ['', packageName] 3 5 4 6 if (version) { 5 7 return { 6 - name: 'package-version' as const, 8 + name: 'package-version', 7 9 params: { 8 10 org, 9 11 name, ··· 13 15 } 14 16 15 17 return { 16 - name: 'package' as const, 18 + name: 'package', 17 19 params: { 18 20 org, 19 21 name,