Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getCampionati() {
- const URL_LISTA_CAMPIONATI : string = "http://api.football-data.org/v2/competitions";
- const campionatiPermessi = [2001, 2019, 2021, 2015, 2002, 2013];
- const observable = this.http.get(URL_LISTA_CAMPIONATI, {
- headers : {'X-Auth-Token': 'b96d850637b24b5c92df997a3bd9d695'},
- responseType: 'json'
- })
- let prova = observable.pipe(
- map(x => x['competitions']),
- switchMap(x => x),
- filter(camp => campionatiPermessi.find(x => x === camp['id'] ) ? true : false)
- ).subscribe({
- next(val) {
- console.log(val);
- },
- error(err) {
- console.log("Error: " + err);
- },
- complete() {
- console.log("Complete");
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement