Skip to content

Commit 0da0408

Browse files
committed
fix: set org to empty string to make sure its route param is omitted
1 parent 3cf7fef commit 0da0408

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

app/utils/router.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
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('@')
5+
? (packageName.split('/') as [string, string])
6+
: ['', packageName]
37

48
if (version) {
59
return {
6-
name: 'package-version' as const,
10+
name: 'package-version',
711
params: {
812
org,
913
name,
@@ -13,7 +17,7 @@ export function packageRoute(packageName: string, version?: string | null) {
1317
}
1418

1519
return {
16-
name: 'package' as const,
20+
name: 'package',
1721
params: {
1822
org,
1923
name,

0 commit comments

Comments
 (0)