So basically I've been trying to fetch the wallpaper links from reddit.com/r/wallpapers and use them in some images in a vue file using axios.
However, when retrieving, the preview links (postObjList[0].data.preview.images[0].source.url)
are giving me the above-mentioned error, even when I try to manually enter them on my chrome address bar. What is wrong and how to solve this?
<template>
<div class="hello">
<img id= "test" src="" alt="">
</div>
</template>
<script>
const axios = require('axios')
export default {
name: 'HelloWorld',
props: {
msg: String
},
created() {
axios.get('https://www.reddit.com/r/wallpapers.json')
.then(response => {
let postObjList = response.data.data.children
console.log(postObjList)
let thumbnail = postObjList[0].data.preview.images[0].source.url
console.log(thumbnail)
document.getElementById("test").src = thumbnail
})
}
}