Skip to content

Commit 77a36e5

Browse files
committed
feat: http calls use auth tokens from nuxt config
1 parent 4e1f82b commit 77a36e5

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

components/signup-card.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
</template>
111111

112112
<script setup>
113-
const SINGULARITY_DEMO_SIGNUPS_TOKEN = import.meta.env.VITE_AIRTABLE_SINGULARITY_DEMO_TOKEN
113+
const config = useRuntimeConfig()
114114
const buttonStore = useZeroButtonStore()
115115
// ======================================================================= Props
116116
const props = defineProps({
@@ -220,7 +220,7 @@ const submitForm = async () => {
220220
}
221221
const headers = {
222222
'Content-Type': 'application/json',
223-
'Authorization': `Bearer ${SINGULARITY_DEMO_SIGNUPS_TOKEN}`
223+
'Authorization': `Bearer ${config.public.airtableToken}`
224224
}
225225
const res = await $fetch('https://api.airtable.com/v0/apphbQmrNLNNXiaqG/tblDUSr66nczukX9Y', {
226226
method: 'POST',

components/subfooter-form.vue

+12-12
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</template>
4343

4444
<script setup>
45-
const SINGULARITY_DEMO_SIGNUPS_TOKEN = import.meta.env.VITE_AIRTABLE_SINGULARITY_DEMO_TOKEN
45+
const config = useRuntimeConfig()
4646
const buttonStore = useZeroButtonStore()
4747
// ======================================================================= Props
4848
const props = defineProps({
@@ -93,18 +93,18 @@ const submitForm = async () => {
9393
if (formSubmitted.value) { return }
9494
if (field.value) {
9595
const body = {
96-
records: [
97-
{
98-
fields: {
99-
email: field.value
100-
}
96+
records: [
97+
{
98+
fields: {
99+
email: field.value
101100
}
102-
]
103-
}
104-
const headers = {
105-
'Content-Type': 'application/json',
106-
'Authorization': `Bearer ${SINGULARITY_DEMO_SIGNUPS_TOKEN}`
107-
}
101+
}
102+
]
103+
}
104+
const headers = {
105+
'Content-Type': 'application/json',
106+
'Authorization': `Bearer ${config.public.airtableToken}`
107+
}
108108
const res = await $fetch('https://api.airtable.com/v0/apphbQmrNLNNXiaqG/tblSB1NYasWQIDGlp', {
109109
method: 'POST',
110110
body,

nuxt.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export default defineNuxtConfig({
2626
serverFlag: env,
2727
seo: {
2828
siteName: seo.siteName
29-
}
29+
},
30+
airtableToken: process.env.AIRTABLE_SINGULARITY_ACCESS_TOKEN
3031
}
3132
},
3233
// ////////////////////////////////////////////////////////// Server & Bundler

0 commit comments

Comments
 (0)