diff --git a/pages/category/[id].vue b/pages/category/[id].vue index 25dcc183..8f9216c2 100644 --- a/pages/category/[id].vue +++ b/pages/category/[id].vue @@ -1,10 +1,12 @@ diff --git a/pages/embedded/[p1]/[poiId].vue b/pages/embedded/[p1]/[poiId].vue index d50588f4..a16f922c 100644 --- a/pages/embedded/[p1]/[poiId].vue +++ b/pages/embedded/[p1]/[poiId].vue @@ -12,7 +12,7 @@ definePageMeta({ return false } - return regexForCategoryIds.test(params.p1.toString()) && regexForPOIIds.test(params.poiId.toString()) + return !!params.p1 && !!params.poiId && regexForCategoryIds.test(params.p1.toString()) && regexForPOIIds.test(params.poiId.toString()) }, }) diff --git a/pages/embedded/[p1]/index.vue b/pages/embedded/[p1]/index.vue index b8e8f76a..1698aa6d 100644 --- a/pages/embedded/[p1]/index.vue +++ b/pages/embedded/[p1]/index.vue @@ -6,7 +6,7 @@ import { regexForCategoryIds } from '~/composables/useIdsResolver' // definePageMeta({ validate: ({ params }) => { - return regexForCategoryIds.test(params.p1.toString()) + return !!params.p1 && regexForCategoryIds.test(params.p1.toString()) }, }) diff --git a/pages/index/[p1]/[poiId].vue b/pages/index/[p1]/[poiId].vue index d50588f4..a16f922c 100644 --- a/pages/index/[p1]/[poiId].vue +++ b/pages/index/[p1]/[poiId].vue @@ -12,7 +12,7 @@ definePageMeta({ return false } - return regexForCategoryIds.test(params.p1.toString()) && regexForPOIIds.test(params.poiId.toString()) + return !!params.p1 && !!params.poiId && regexForCategoryIds.test(params.p1.toString()) && regexForPOIIds.test(params.poiId.toString()) }, }) diff --git a/pages/index/[p1]/index.vue b/pages/index/[p1]/index.vue index b8e8f76a..1698aa6d 100644 --- a/pages/index/[p1]/index.vue +++ b/pages/index/[p1]/index.vue @@ -6,7 +6,7 @@ import { regexForCategoryIds } from '~/composables/useIdsResolver' // definePageMeta({ validate: ({ params }) => { - return regexForCategoryIds.test(params.p1.toString()) + return !!params.p1 && regexForCategoryIds.test(params.p1.toString()) }, }) diff --git a/pages/poi/[id]/details.vue b/pages/poi/[id]/details.vue index 0ceaaeca..5a6fd816 100644 --- a/pages/poi/[id]/details.vue +++ b/pages/poi/[id]/details.vue @@ -8,15 +8,14 @@ import type { ApiPoi } from '~/lib/apiPois' import { headerFromSettings } from '~/lib/apiSettings' import { getAsyncDataOrThrows } from '~/lib/getAsyncData' import { siteStore as useSiteStore } from '~/stores/site' +import { regexForPOIIds } from '~/composables/useIdsResolver' // // Validators // definePageMeta({ validate({ params }) { - return ( - typeof params.id === 'string' && /^[-\w:]+$/.test(params.id) - ) + return !!params.id && regexForPOIIds.test(params.id.toString()) }, }) diff --git a/pages/pois/[ids]/map.vue b/pages/pois/[ids]/map.vue index 3ba63727..72ae2c76 100644 --- a/pages/pois/[ids]/map.vue +++ b/pages/pois/[ids]/map.vue @@ -4,16 +4,14 @@ import MapPois from '~/components/Map/MapPois.vue' import { type ApiPoiId, type ApiPois, getPois } from '~/lib/apiPois' import { getAsyncDataOrThrows } from '~/lib/getAsyncData' import { siteStore as useSiteStore } from '~/stores/site' +import { regexForCategoryIds } from '~/composables/useIdsResolver' // // Validators // definePageMeta({ validate({ params }) { - return ( - typeof params.ids === 'string' - && /^[-\w:,]+$/.test(params.ids) - ) + return !!params.ids && regexForCategoryIds.test(params.ids.toString()) }, })