const data = { name: 'test', artist: 'abc' }
if(!data.name || !data.artist) { console.log('数据格式不正确'); return; }
axios.post('URL', data) .then(res => console.log(res)) .catch(err => console.log(err));
const token = 'XXXXXXXXXXXXXXXXXXXXX';
axios.post('https://api.spotify.com/v1/search?type=artist&q=query', {}, {
headers: {
Authorization: Bearer ${token}
}
})
.then(res => console.log(res))
.catch(err => console.log(err));