diff --git a/src/app/user/history/page-history-user/page-history-user.component.ts b/src/app/user/history/page-history-user/page-history-user.component.ts index b8f7fc8..6c80566 100644 --- a/src/app/user/history/page-history-user/page-history-user.component.ts +++ b/src/app/user/history/page-history-user/page-history-user.component.ts @@ -47,6 +47,7 @@ export class PageHistoryUserComponent implements AfterViewInit this.userHistoryService.clearTabVideoUrlClicked(); // --- FAUX CODE --- + /* const tabVideoAll: VideoAll[] = this.fictitiousVideosService.getTabVideoAll(8); let tabVideoHistory: VideoHistory[] = []; for(let videoAll of tabVideoAll) tabVideoHistory.push(this.videoAllToVideoHistory(videoAll)); @@ -54,20 +55,37 @@ export class PageHistoryUserComponent implements AfterViewInit this.dataSource.sort = this.sort; this.dataSource.paginator = this.paginator; this.dataSource = this.dataSource; + */ - // --- VRAI CODE --- - /* this.messageService - .sendMessage( "user/get/history", null ) - .subscribe( retour => { + .get("user/history") + .subscribe(ret => this.ngAfterViewInitCallback(ret), err => this.ngAfterViewInitCallback(err)); - if(retour.status === "error") console.log(retour); - else { - this.dataSource = new MatTableDataSource(retour.data); - this.dataSource.sort = this.sort; + } + + + ngAfterViewInitCallback(retour: any): void + { + console.log(retour); + + if(retour.status !== "success") { + //console.log(retour); + } + else { + const tabVideoHistory = retour.data.map( video => { + return { + videoId: video.videoId, + imageUrl: video.imageUrl, + title: video.title, + date: video.watchedDate, + source: video.source, } }); - */ + this.dataSource = new MatTableDataSource(tabVideoHistory); + this.dataSource.sort = this.sort; + this.dataSource.paginator = this.paginator; + this.dataSource = this.dataSource; + } } diff --git a/src/app/user/search/page-search/page-search.component.html b/src/app/user/search/page-search/page-search.component.html index c9154c2..eb2ad12 100644 --- a/src/app/user/search/page-search/page-search.component.html +++ b/src/app/user/search/page-search/page-search.component.html @@ -16,7 +16,7 @@
-
+
@@ -38,7 +38,7 @@
-
+
-
+
+