Skip to content

Commit

Permalink
fix: make category ids acts as folder
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab authored and frodrigo committed Dec 18, 2024
1 parent cb2b96f commit 0bff986
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pages/embedded.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ if (boundary && typeof boundary === 'string' && settings.value!.polygons_extra)
if (route.params.p1) {
const match = route.params.p1.toString().match(regexForCategoryIds)
if (!match || (!route.path.endsWith('/') && match.groups && (match.groups.cartocode || match.groups.reference || match.groups.osm)))
if (!match || (route.path.endsWith('/') && match.groups && (match.groups.cartocode || match.groups.reference || match.groups.osm)))
throw createError({ statusCode: 400, message: `No match for category ID: ${route.params.p1}` })
categoryIds.value = match.input?.split(',').map(id => Number.parseInt(id))
}
// Get POI ID from URL
if (categoryIds.value?.length === 1 && route.name === 'index-p1' && route.path.endsWith('/')) {
if (categoryIds.value?.length === 1 && route.name === 'index-p1' && !route.path.endsWith('/')) {
poiId.value = route.params.p1?.toString()
categoryIds.value = undefined
}
Expand Down
4 changes: 2 additions & 2 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ if (boundary && typeof boundary === 'string' && settings.value!.polygons_extra)
if (route.params.p1) {
const match = route.params.p1.toString().match(regexForCategoryIds)
if (!match || (!route.path.endsWith('/') && match.groups && (match.groups.cartocode || match.groups.reference || match.groups.osm)))
if (!match || (route.path.endsWith('/') && match.groups && (match.groups.cartocode || match.groups.reference || match.groups.osm)))
throw createError({ statusCode: 400, message: `No match for category ID: ${route.params.p1}` })
categoryIds.value = match.input?.split(',').map(id => Number.parseInt(id))
}
// Get POI ID from URL
if (categoryIds.value?.length === 1 && route.name === 'index-p1' && route.path.endsWith('/')) {
if (categoryIds.value?.length === 1 && route.name === 'index-p1' && !route.path.endsWith('/')) {
poiId.value = route.params.p1?.toString()
categoryIds.value = undefined
}
Expand Down

0 comments on commit 0bff986

Please sign in to comment.