You've already forked AstralRinth
forked from didirus/AstralRinth
Refactor search page, migrate to /discover/ (#4862)
This commit is contained in:
13
apps/frontend/src/utils/router.ts
Normal file
13
apps/frontend/src/utils/router.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { LocationQueryValue, RouteRecordNameGeneric } from 'vue-router'
|
||||
|
||||
export function queryAsStringOrEmpty(query: LocationQueryValue | LocationQueryValue[]): string {
|
||||
return Array.isArray(query) ? (query[0] ?? '') : (query ?? '')
|
||||
}
|
||||
|
||||
export function queryAsString(query: LocationQueryValue | LocationQueryValue[]): string | null {
|
||||
return Array.isArray(query) ? (query[0] ?? null) : (query ?? null)
|
||||
}
|
||||
|
||||
export function routeNameAsString(name: RouteRecordNameGeneric | undefined): string | undefined {
|
||||
return name && typeof name === 'string' ? (name as string) : undefined
|
||||
}
|
||||
Reference in New Issue
Block a user