I’m trying to make a get request to githubjobs API in my nuxt app using axios. I have axios properly setup and configured. Here is the action I want to dispatch:
async defaultJobsFetch({commit}){
try{
const res = await axios.get('https://jobs.github.com/positions.json?location=new+york')
const jobs = res.data;
commit('getJobs', jobs)
}catch(error){
commit("errored");
console.log(error)
}
finally{
commit('changeLoading')
}
},
I tried using https://cors-anywhere.herokupp.com/ too, but I still get an error 403 forbidden
I noticed it works fine on my local machine but when i deploy, and try to load the deployed app, I don’t get a response back, i get that 403 error instead. The app is hosted on heroku, http://hubjobs.herokuapp.com, check the console when you visit the site to see the error
One workaround would be to use a chrome extension like CORS unblock or try having this in the header :