Migrate to Angular 4
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Headers, Http } from '@angular/http';
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/operator/toPromise';
|
||||
import 'rxjs/add/operator/map';
|
||||
|
||||
import { Song } from './object/song';
|
||||
import { Song } from './object/song';
|
||||
import { Album } from './object/album';
|
||||
import { Artist } from './object/artist';
|
||||
import { Bucket } from './object/bucket';
|
||||
@@ -117,7 +117,7 @@ export class ElsService {
|
||||
return res.json().hits.hits;
|
||||
})
|
||||
.map((hits: Array<any>) => {
|
||||
let result: Array<Song> = [];
|
||||
const result: Array<Song> = [];
|
||||
hits.forEach((hit) => {
|
||||
result.push(hit._source);
|
||||
});
|
||||
@@ -134,7 +134,7 @@ export class ElsService {
|
||||
}
|
||||
|
||||
getAlbumSongs(albumName: string, from: number = 0): Observable<Song[]> {
|
||||
console.debug('getAlbumSongs- Album name: ' + albumName + ' - from: ' + from);
|
||||
console.info('getAlbumSongs- Album name: ' + albumName + ' - from: ' + from);
|
||||
return this.http
|
||||
.post(this.elsUrl + 'song' + ElsService.ACTION_SEARCH,
|
||||
JSON.stringify({
|
||||
@@ -148,7 +148,7 @@ export class ElsService {
|
||||
return res.json().hits.hits;
|
||||
})
|
||||
.map((hits: Array<any>) => {
|
||||
let result: Array<Song> = [];
|
||||
const result: Array<Song> = [];
|
||||
hits.forEach((hit) => {
|
||||
result.push(hit._source);
|
||||
});
|
||||
@@ -157,7 +157,7 @@ export class ElsService {
|
||||
}
|
||||
|
||||
getArtistSongs(artistName: string, from: number = 0): Observable<Song[]> {
|
||||
console.debug('getArtistSongs- Artist name: ' + artistName + ' - from: ' + from);
|
||||
console.info('getArtistSongs- Artist name: ' + artistName + ' - from: ' + from);
|
||||
return this.http
|
||||
.post(this.elsUrl + 'song' + ElsService.ACTION_SEARCH,
|
||||
JSON.stringify({
|
||||
@@ -176,7 +176,7 @@ export class ElsService {
|
||||
return res.json().hits.hits;
|
||||
})
|
||||
.map((hits: Array<any>) => {
|
||||
let result: Array<Song> = [];
|
||||
const result: Array<Song> = [];
|
||||
hits.forEach((hit) => {
|
||||
result.push(hit._source);
|
||||
});
|
||||
@@ -251,7 +251,7 @@ export class ElsService {
|
||||
}), {headers: this.headers})
|
||||
.map(res => res.json().aggregations.genres.buckets)
|
||||
.map((hits: Array<any>) => {
|
||||
let result: Array<Bucket> = [];
|
||||
const result: Array<Bucket> = [];
|
||||
hits.forEach((bucket) => {
|
||||
result.push(bucket);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user