Answer the question
In order to leave comments, you need to log in
Service for obtaining exchange rates - why does not work?
Good evening. I'm trying to write a service for getting exchange rates. I use the following portal - https://currencylayer.com/ .
According to the manual, I get the following code:
getCurrensy(): Observable<any> {
const url = 'http://apilayer.net/api/live?access_key=<b>mykey</b>¤cies=EUR,RUB&source=USD&format=1'
return this.http.jsonp(url, '')
.pipe(
map((response: Response) => response.json())
)
}
this.organizationService.getCurrensy().subscribe(
curr => {
console.log(curr)
}
)
Uncaught SyntaxError: Unexpected token :
Answer the question
In order to leave comments, you need to log in
NO, I just replaced my key for the forum, believe me it is. In the statistics of my personal account, it is noted that the request was. In the Google "Developer Tool" in the Network tab, I get all the necessary data, but there is an error in the component itself.
I think I understand what's going on. My project uses jwt-token to protect my "internal" routes and apparently the "external" request is not registered with me and swears at an unknown token. Could this be the issue?
I use it like this:
How can I add protection to the outer request?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question