Fix API calls using a bearer auth token
This commit is contained in:
@@ -7,13 +7,14 @@
|
||||
export async function preload (page, session) {
|
||||
// Load the photos if not loaded
|
||||
if (!preloaded) {
|
||||
// Fields
|
||||
const fields = [
|
||||
'id', 'name', 'slug', 'date', 'image.private_hash',
|
||||
'location.id', 'location.name', 'location.slug',
|
||||
'location.country.name', 'location.country.slug'
|
||||
]
|
||||
const req = await this.fetch(`${apiEndpoints.rest}/items/photos?fields=${fields.join()}&filter[location.slug][rlike]=%${page.params.place}%`)
|
||||
const req = await this.fetch(`${apiEndpoints.rest}/items/photos?fields=${fields.join()}&filter[location.slug][rlike]=%${page.params.place}%`, {
|
||||
'Authorization': 'bearer ' + process.env.CONFIG.API_TOKEN
|
||||
})
|
||||
const photos = await req.json()
|
||||
if (req.ok) {
|
||||
return { photos: photos.data }
|
||||
|
||||
Reference in New Issue
Block a user