Skip to content

Commit 29d1ac0

Browse files
authored
fix: set org to empty string to make sure its route param is omitted (#1126)
1 parent 3256342 commit 29d1ac0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/utils/router.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
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]
35

46
if (version) {
57
return {
6-
name: 'package-version' as const,
8+
name: 'package-version',
79
params: {
810
org,
911
name,
@@ -13,7 +15,7 @@ export function packageRoute(packageName: string, version?: string | null) {
1315
}
1416

1517
return {
16-
name: 'package' as const,
18+
name: 'package',
1719
params: {
1820
org,
1921
name,

0 commit comments

Comments
 (0)