Javascript issue while calling API

General project discussion.
Use this as a last resort if your topic does not fit in any of the other boards but it still on-topic.
Forum rules
This General Discussion board is meant for topics that are still relevant to Pale Moon, web browsers, browser tech, UXP applications, and related, but don't have a more fitting board available.

Please stick to the relevance of this forum here, which focuses on everything around the Pale Moon project and its user community. "Random" subjects don't belong here, and should be posted in the Off-Topic board.
User avatar
TimJohn909
New to the forum
New to the forum
Posts: 2
Joined: 2022-07-27, 11:54

Javascript issue while calling API

Unread post by TimJohn909 » 2022-07-28, 06:17

Whenerver I'm making an API call, and every time the page loads it comes with this error, somebody please tell me why? I've tried to put it:

mounted () {
this.getStoreScore()
this.fillData()
this.fillData2()
this.fillData3()
this.fillDataScoreLine()
this.fillDataTimeBar()
this.fillDataAnswerPercent()
},


getStoreScore () {
return axios.post('API', {
storeId: '5b7515ed5d53fa0020557447'
}).then(response => {
this.company = {
'storeScore': response.data.result,
'amount': {
'total': response.data.amount.total,
'zero': {
'amount': response.data.amount.zero,
'percentage': response.data.amount.zero / response.data.amount.total * 100
},
'one': {
'amount': response.data.amount.one,
'percentage': response.data.amount.one / response.data.amount.total * 100
},
'two': {
'amount': response.data.amount.two,
'percentage': response.data.amount.two / response.data.amount.total * 100
},
'three': {
'amount': response.data.amount.three,
'percentage': response.data.amount.three / response.data.amount.total * 100
}
}
}
return this.company
})
},

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2183
Joined: 2018-05-05, 13:29

Re: Javascript issue while calling API

Unread post by vannilla » 2022-07-28, 07:13

Which error?
Also this looks like Vue, meaning that the code you posted is not the final code being executed by the browser, so there is no way to tell unless you provide the exact error message.

Locked