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,8 +1,9 @@
|
|||
import {Component, Input, OnChanges } from '@angular/core';
|
||||
import {Component, Input } from '@angular/core';
|
||||
import {VideoAll} from "../../../utils/interfaces/video";
|
||||
import {UserHistoryService} from "../../utils/services/userHistory/userHistory.service";
|
||||
import {AddVideoToPlaylistsService} from "../../utils/services/addVideoToPlaylists/add-video-to-playlists.service";
|
||||
import {Router} from "@angular/router";
|
||||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
|
||||
|
||||
|
||||
|
|
@ -11,26 +12,24 @@ import {Router} from "@angular/router";
|
|||
templateUrl: './video-grid.component.html',
|
||||
styleUrls: ['./video-grid.component.scss']
|
||||
})
|
||||
export class VideoGridComponent implements OnChanges
|
||||
export class VideoGridComponent
|
||||
{
|
||||
@Input() tabVideo: VideoAll[] = [];
|
||||
@Input() search: string = '';
|
||||
indexPage: number = 0;
|
||||
|
||||
|
||||
constructor( private historiqueService: UserHistoryService,
|
||||
private addVideoToPlaylistsService: AddVideoToPlaylistsService,
|
||||
private router: Router) {}
|
||||
private router: Router,
|
||||
private messageService: MessageService ) {}
|
||||
|
||||
|
||||
ngOnChanges(): void
|
||||
onAddToPlaylist(video: VideoAll): void
|
||||
{
|
||||
//this.historiqueService.clearTabVideoUrlClicked();
|
||||
this.addVideoToPlaylistsService.run(video.videoId, video.source, video.interest);
|
||||
}
|
||||
|
||||
onAdd(video: VideoAll): void
|
||||
{
|
||||
this.addVideoToPlaylistsService.run(video.videoId, video.source);
|
||||
}
|
||||
|
||||
tronquage(str: string)
|
||||
{
|
||||
|
|
@ -38,10 +37,22 @@ export class VideoGridComponent implements OnChanges
|
|||
else return str.substring(0, 30) + "..." ;
|
||||
}
|
||||
|
||||
|
||||
onVideo(video: VideoAll): void
|
||||
{
|
||||
const data = { source: video.source, interest: video.interest };
|
||||
this.messageService
|
||||
.post("video/create/"+video.videoId, data)
|
||||
.subscribe(ret => this.onVideoCallback(ret), err => this.onVideoCallback(err));
|
||||
|
||||
const url = '/user/watching/fromSearch/'+video.videoId+'/'+video.source+'/'+this.search;
|
||||
this.router.navigateByUrl(url);
|
||||
}
|
||||
|
||||
|
||||
onVideoCallback(retour: any): void
|
||||
{
|
||||
if(retour.status !== "success") console.log(retour);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue