Fix API calls using a bearer auth token
This commit is contained in:
@@ -4,15 +4,16 @@
|
||||
|
||||
// Preload data (photos to display)
|
||||
export async function preload (page, session) {
|
||||
// Fields
|
||||
// Load Carousel photos
|
||||
const fields = [
|
||||
'id', 'name', 'image.private_hash',
|
||||
'location.id', 'location.name', 'location.slug',
|
||||
'location.country.name', 'location.country.slug'
|
||||
]
|
||||
// Random sort
|
||||
const sort = '?'
|
||||
const req = await this.fetch(`${apiEndpoints.rest}/items/photos?fields=${fields.join()}&sort=${sort}&limit=${limit}`)
|
||||
const sort = '?' // Random sort
|
||||
const req = await this.fetch(`${apiEndpoints.rest}/items/photos?fields=${fields.join()}&sort=${sort}&limit=${limit}`, {
|
||||
'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