diff --git a/dashboard/src/app/album/album.component.ts b/dashboard/src/app/album/album.component.ts index 029e8eb..7fddf04 100644 --- a/dashboard/src/app/album/album.component.ts +++ b/dashboard/src/app/album/album.component.ts @@ -22,6 +22,7 @@ export class AlbumComponent implements OnInit { // Prevent useless data load + activate button in interface var moreDataAvailable = true; + lockLoadData = false; constructor( private elsService: ElsService, @@ -39,10 +40,16 @@ export class AlbumComponent implements OnInit { } loadSongs(): void { + if (this.lockLoadData) { + console.log('Loading data locked'); + return; + } + if (!this.moreDataAvailable) { return; } + this.lockLoadData = true; this.elsService.getAlbumSongs(this.albumName, this.songs.length).subscribe( data => { this.moreDataAvailable = data.length === ElsService.DEFAULT_SIZE; @@ -57,6 +64,8 @@ export class AlbumComponent implements OnInit { this.songs.push(song); }); } + console.log('Unlock load data'); + this.lockLoadData = false; } ); }