There is an API, from where the data from the database is steamed, which should be displayed on the landing page.
Everything seems to be spelled out correctly, but the landing gives as undefined.
What could be the problem?
code:
function Link() {
let params = useParams();
try {
axios.get(`https://api.***/get_link?id=${params.id}`)
.then(res => {
if(res.data.error === false) {
document.title = `${res.data.link.artists} — ${res.data.link.title} ***`
document.getElementById('title').innerHTML = res.data.link.title
document.getElementById('artists').innerHTML = res.data.link.artists
document.getElementById('cover').src = 'https://api.***/' + res.data.link.cover
let link = res.data.link
if(link.apple) {
document.getElementById('apple').href = link.apple
document.getElementById('apple').hidden = ''
}
if(link.vk) {
document.getElementById('vk').href = link.vk
document.getElementById('vk').hidden = ''
}
if(link.yandex) {
document.getElementById('yandex').href = link.yandex
document.getElementById('yandex').hidden = ''
}
if(link.yt_music) {
document.getElementById('yt').href = link.yt_music
document.getElementById('yt').hidden = ''
}
if(link.spotify) {
document.getElementById('spotify').href = link.spotify
document.getElementById('spotify').hidden = ''
}
if(link.soundcloud) {
document.getElementById('soundcloud').href = link.soundcloud
document.getElementById('soundcloud').hidden = ''
}
if(link.itunes) {
document.getElementById('itunes').href = link.itunes
document.getElementById('itunes').hidden = ''
}
if(link.tidal) {
document.getElementById('tidal').href = link.tidal
document.getElementById('tidal').hidden = ''
}
if(link.deezer) {
document.getElementById('deezer').href = link.deezer
document.getElementById('deezer').hidden = ''
}
} else {
redirect()
}
})
} catch {
I’ve already racked my brain xd