Обещания возвращают другое обещание.
Способ распаковки и работы с обещанием осуществляется с помощью функции .then (), которая запускается после возврата обещания.
const asset = getAssetInformation(11002);
function getAssetInformation(id) {
return axios({
method: 'GET',
url: "/asset-information",
params: {assetId: id}
});
}
Активом здесь является обещание, которое вы хотитеиспользуйте затем на него, чтобы получить значение.
Вместо ..
const asset = getAssetInformation(11002);
используйте
getAssetInformation(11002)
.then((response) => {
//What you returned will be here, use response.data to get your data out.
} )
.catch((err) => {
//if there is an error returned, put behavior here.
})