angular - How to add api key in the given URL?
问题描述
I'm trying to add API key in the given Angular Service, after compilation, it is showing %22 in the API URL. Can anyone please help how to send the correct API request?
async getCurrencies() {
this.formatValidTimePeriod()
this.statusService.sendStatus('updateStarted')
let result = new Promise<void>(async (resolve, reject)=> {
let datePeriodURLString = this.formatDatePeriodURLString()
// console.log(this.datePeriod)
await this.HTTPReq("GET",this.exchangeAPI,`${datePeriodURLString}"access_key="${this.key}base=${this.baseCurrency.active}`).then((res)=>{
let rates=res.rates
if (this.baseCurrency.dropDownList.length < 1) {
this.setCurrencyDropDownList(rates)
}
if (!this.currencies.selected.active) {
this.currencies.list = rates;
} else {
this.setPricesForSelectedCurrency(rates)
}
resolve()
this.statusService.sendStatus('updateFinished')
})
});
return result
}
解决方案
推荐阅读
- azure - 为什么我在使用 eventhubs 时在 Azure 上收到此错误?
- sql - vba中的sql脚本
- python - plt.imshow() 只显示黑白图像
- javascript - 在 Next JS 中使用来自 `@mdx-js/react` 的 `MDXProvider` 时,MDX 博客仅显示降价内容而不是渲染它
- python - 给定一个图,我怎样才能得出节点的位置,以便图中的派系接近?
- python - 如何循环滚动/移动熊猫系列
- ios - Cordova iOS app icon always shows default icon on iPad OS 13.7
- java - Thread in stream vs Parallel Stream
- javascript - How to import repeated function in React
- javascript - Vue页面在加载时不会向下滚动