Help

API Key to Personal Access Token Not Working

295 1
cancel
Showing results for 
Search instead for 
Did you mean: 
john12345
4 - Data Explorer
4 - Data Explorer

Hi there! We have the code below but it's not working. I'm not sure why.

<template>
<div>
<iframe
:src="link"
style="height: calc(100vh - 1px); width: 100%; border: none"
frameborder="0"
></iframe>
</div>
</template>

<script>
import Airtable from 'airtable'
const base = new Airtable({ apiKey: process.env.airtableApiKey }).base(
process.env.airtableBaseId
)

export default {
name: 'IndexPage',
data() {
return {
link: '',
}
},
async mounted() {
try {
this.link = await this.getLink(this.$route.query.locationId)
} catch (e) {
console.log(e)
}
},
methods: {
async getLink(locationId) {
try {
const record = await base(process.env.airtableTableName)
.select({ filterByFormula: `{location_id} = "${locationId}"` })
.firstPage()

return record[0].fields.share_url
} catch (error) {
console.log(error)
}
},
},
}
</script>

1 Reply 1

Some questions:
1. Where are you running this code?
2. What error message do you get?
3. How much experience do you have with programming?