avancement dans la connexion du back avec la partie user
This commit is contained in:
parent
7030a0ea21
commit
7444715b2f
11 changed files with 121 additions and 168 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, Input, OnChanges, SimpleChanges} from '@angular/core';
|
||||
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {VideoAll, VideoDB} from "../../../utils/interfaces/video";
|
||||
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||
|
|
@ -6,9 +6,10 @@ import {MessageService} from "../../../utils/services/message/message.service";
|
|||
import {PlaylistDB} from "../../../utils/interfaces/playlist";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
||||
import {FictitiousUtilsService} from "../../../utils/services/fictitiousDatas/fictitiousUtils/fictitious-utils.service";
|
||||
import {FictitiousVideosService} from "../../../utils/services/fictitiousDatas/fictitiousVideos/fictitious-videos.service";
|
||||
import {Router} from "@angular/router";
|
||||
import {HttpParams} from "@angular/common/http";
|
||||
import {ProfilService} from "../../../utils/services/profil/profil.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -17,24 +18,58 @@ import {Router} from "@angular/router";
|
|||
templateUrl: './video-list.component.html',
|
||||
styleUrls: ['./video-list.component.scss']
|
||||
})
|
||||
export class VideoListComponent implements OnChanges
|
||||
export class VideoListComponent implements OnChanges, OnInit
|
||||
{
|
||||
@Input() playlist: PlaylistDB;
|
||||
@Input() playlist: any;
|
||||
videosInPlaylist: VideoAll[] = [];
|
||||
allUserVideos: VideoAll[] = this.fictitiousVideosService.get_TAB_VIDEO();
|
||||
|
||||
|
||||
constructor( private messageService: MessageService,
|
||||
public themeService: ThemeService,
|
||||
private fictitiousUtilsService: FictitiousUtilsService,
|
||||
private addVideoToPlaylistService: AddVideoToPlaylistsService,
|
||||
private snackBar: MatSnackBar,
|
||||
public fictitiousVideosService: FictitiousVideosService,
|
||||
private historiqueService: UserHistoryService,
|
||||
private profilService: ProfilService,
|
||||
private router: Router ) { }
|
||||
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
let params = new HttpParams();
|
||||
params = params.append("userId", this.profilService.id);
|
||||
console.log("id: " + this.profilService.id);
|
||||
this.messageService
|
||||
.get("video/findAll", params)
|
||||
.subscribe(ret => this.afterReceivingUserVideo(ret), err => this.afterReceivingUserVideo(err));
|
||||
}
|
||||
|
||||
|
||||
afterReceivingUserVideo(retour: any)
|
||||
{
|
||||
console.log("afterReceivingUserVideo: ");
|
||||
console.log(retour);
|
||||
|
||||
if(retour.status !== "success") {
|
||||
//console.log(retour);
|
||||
}
|
||||
else {
|
||||
this.allUserVideos = retour.data;
|
||||
this.reloadVideoInPlaylist();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void
|
||||
{
|
||||
console.log("ngOnChanges:");
|
||||
console.log(this.playlist);
|
||||
this.reloadVideoInPlaylist();
|
||||
}
|
||||
|
||||
|
||||
reloadVideoInPlaylist(): void
|
||||
{
|
||||
if((this.playlist !== null) && (this.playlist !== undefined))
|
||||
{
|
||||
|
|
|
|||
Reference in a new issue