Skip to content

Commit

Permalink
Include Basic Auth in catalog request
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBroersma committed Nov 27, 2023
1 parent 55f51d1 commit 4e6df10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
1 change: 1 addition & 0 deletions app/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default defineNuxtConfig({
public: {
stacRoot: process.env.NUXT_STAC_ROOT,
mapboxToken: process.env.NUXT_PUBLIC_MAPBOX_TOKEN,
password: process.env.NUXT_PUBLIC_PASSWORD,
},
},
css: ['vuetify/styles'],
Expand Down
19 changes: 6 additions & 13 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,21 @@ type CollectionType = typeof collectionShape
let url = useRequestURL()
let {
public: { mapboxToken },
public: { mapboxToken, password },
} = useRuntimeConfig()
let baseURL = url.protocol + '//' + url.host + '/stac'
console.log({ baseURL })
let catalogPath = `${baseURL}/catalog.json`
let { data: catalogJson } = await useAsyncData<CatalogType>(() =>
fetch(catalogPath)
.then((res) => res.json())
.catch((err) => {
console.error(err)
return null
}),
)
let { data: catalogJson } = await useFetch<CatalogType>(catalogPath, {
headers: {
Authorization: `Basic ${btoa(password)}`,
},
})
let catalog = catalogJson.value
console.log({ catalog })
let childrenLinks = catalog?.links.filter((link) => link.rel === 'child') ?? []
let collections = (
Expand Down

0 comments on commit 4e6df10

Please sign in to comment.