Skip to content

Commit

Permalink
Refactor index.vue to dynamically construct subsidence collection URL
Browse files Browse the repository at this point in the history
- Replaced hardcoded subsidence collection URL with a dynamic construction using the request URL protocol and host.
- Streamlined the code by removing redundant variable declarations and improving overall readability.
  • Loading branch information
RobertBroersma committed Dec 20, 2024
1 parent 3f9ea92 commit 63b2e39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ let {
public: { mapboxToken, pdfEndpoint },
} = useRuntimeConfig()
let url = useRequestURL()
let headers = useRequestHeaders()
let collectionLinks = [
'https://raw.githubusercontent.com/openearth/coclicodata/8aabe3516bdb287d9972618d28e6471b7a69adf9/current/cfhp/collection.json',
'https://raw.githubusercontent.com/openearth/coclicodata/8aabe3516bdb287d9972618d28e6471b7a69adf9/current/slp/collection.json',
'https://raw.githubusercontent.com/openearth/coclicodata/62ccb63944edaaadecb140eca57003a3b95d091d/current/deltares-delta-dtm/collection.json',
'http://localhost:3000/collections/subsidence.json',
url.protocol + '//' + url.host + '/collections/subsidence.json',
]
let collections = await useCollections({ collectionLinks })
Expand Down Expand Up @@ -96,7 +98,6 @@ function isCollectionIntersecting(collection: CollectionType) {
return turf.intersect(collectionBboxPolygon, drawnBboxPolygon) !== null
}
let url = useRequestURL()
let { data: countries } = await useFetch(
url.protocol + '//' + url.host + '/countries.json',
)
Expand Down

0 comments on commit 63b2e39

Please sign in to comment.