首页 > 解决方案 > 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
  }

标签: angulartypescript

解决方案


推荐阅读