MrBobDaisy
MrBobDaisy
NNuxt
Created by MrBobDaisy on 6/28/2024 in #❓・help
Server directory API call will only work with 127.0.0.1
Bumping this
2 replies
NNuxt
Created by reinacchi on 6/28/2024 in #❓・help
background isn't adjusted properly
I'd recommend making the background of NuxtPage to the image, but if you can't do that, you might need to set the styles to absolute top-0 bottom-0 w-full h-full or absolute top-0 bottom-0 w-full h-screen
8 replies
NNuxt
Created by reinacchi on 6/28/2024 in #❓・help
background isn't adjusted properly
@reinacchi What is the issue that you're looking at?
8 replies
NNuxt
Created by MrBobDaisy on 5/2/2024 in #❓・help
Use external ApiS in Nuxt?
Good to know that's the right way. I know the URL could also benefit from being in my .env file but the way this particular API works, they use the URL to update some stuff so I can't really store it in the .env . I guess technically I could store the "meat" of the URL in that file but that's not going to change much of anything. I think security wise it's probably fine. Since the URL/key isn't available client site, the likelihood of someone sending muddy data through is next to none.
13 replies
NNuxt
Created by MrBobDaisy on 5/2/2024 in #❓・help
Use external ApiS in Nuxt?
@FoxForGate So this is my component's API call
const fetchJobs = async () => {

if( searchedCity.value ) {
const { data: city } = await $fetch('/api/jobs/search', {
query: {
city: searchedCity.value
},
onResponse({ response }) {
jobsLoading.value = false
jobData.value = response._data.data
}
})
} else if( searchedTitle.value ) {
const { data: city } = await $fetch('/api/jobs/search', {
query: {
title: searchedTitle.value
},
onResponse({ response }) {
jobsLoading.value = false
jobData.value = response._data.data
}
})
} else {
const { data } = await $fetch('/api/jobs', {

onResponse({ response }) {
jobsLoading.value = false
jobData.value = response._data.data
}
})
}
}

fetchJobs()
const fetchJobs = async () => {

if( searchedCity.value ) {
const { data: city } = await $fetch('/api/jobs/search', {
query: {
city: searchedCity.value
},
onResponse({ response }) {
jobsLoading.value = false
jobData.value = response._data.data
}
})
} else if( searchedTitle.value ) {
const { data: city } = await $fetch('/api/jobs/search', {
query: {
title: searchedTitle.value
},
onResponse({ response }) {
jobsLoading.value = false
jobData.value = response._data.data
}
})
} else {
const { data } = await $fetch('/api/jobs', {

onResponse({ response }) {
jobsLoading.value = false
jobData.value = response._data.data
}
})
}
}

fetchJobs()
And my server/api/jobs call to the API with the private Bearer token
export default defineEventHandler((event) => {
const runtimeConfig = useRuntimeConfig()

let url = `https://api.recruitcrm.io/v1/jobs`

let jobData = null

return $fetch(url, {
method: "GET",
headers: {
'Authorization': `Bearer ${runtimeConfig.recruitToken}`,
},
onResponse({ response }) {
jobData = response._data.data
return jobData
}
})
})
export default defineEventHandler((event) => {
const runtimeConfig = useRuntimeConfig()

let url = `https://api.recruitcrm.io/v1/jobs`

let jobData = null

return $fetch(url, {
method: "GET",
headers: {
'Authorization': `Bearer ${runtimeConfig.recruitToken}`,
},
onResponse({ response }) {
jobData = response._data.data
return jobData
}
})
})
I know a Malicious user might be able to send a request to the API using my server/api call but not concerned about it.
13 replies
NNuxt
Created by MrBobDaisy on 5/2/2024 in #❓・help
Use external ApiS in Nuxt?
Yes, I'll post a solution here to the question when I am back at my laptop
13 replies
NNuxt
Created by MrBobDaisy on 5/2/2024 in #❓・help
Use external ApiS in Nuxt?
Forgot to ping this. I actually am using an proxy to send the request to the server, then submit the api request from the server.
13 replies
NNuxt
Created by MrBobDaisy on 5/2/2024 in #❓・help
Use external ApiS in Nuxt?
I'm a bit newer to external API integration in Nuxt.
13 replies
NNuxt
Created by MrBobDaisy on 5/2/2024 in #❓・help
Use external ApiS in Nuxt?
I'll have to take a look at that
13 replies