|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
import { Component } from "@angular/core";
|
|
|
|
|
import { ImageService, SearchV2Service } from "../services";
|
|
|
|
|
import { ImageService, SearchV2Service, RequestService } from "../services";
|
|
|
|
|
import { ActivatedRoute } from "@angular/router";
|
|
|
|
|
import { DomSanitizer } from "@angular/platform-browser";
|
|
|
|
|
import { ISearchMovieResultV2 } from "../interfaces/ISearchMovieResultV2";
|
|
|
|
|
import { MatDialog } from "@angular/material";
|
|
|
|
|
import { MatDialog, MatSnackBar } from "@angular/material";
|
|
|
|
|
import { MovieDetailsTrailerComponent } from "./movie-details-trailer.component";
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@ -16,7 +16,8 @@ export class MovieDetailsComponent {
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
|
|
|
|
|
private sanitizer: DomSanitizer, private imageService: ImageService,
|
|
|
|
|
public dialog: MatDialog) {
|
|
|
|
|
public dialog: MatDialog, private requestService: RequestService,
|
|
|
|
|
public snackBar: MatSnackBar) {
|
|
|
|
|
this.route.params.subscribe((params: any) => {
|
|
|
|
|
this.theMovidDbId = params.movieDbId;
|
|
|
|
|
this.load();
|
|
|
|
@ -34,8 +35,18 @@ export class MovieDetailsComponent {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public request() {
|
|
|
|
|
//
|
|
|
|
|
public async request() {
|
|
|
|
|
var result = await this.requestService.requestMovie({theMovieDbId: this.theMovidDbId, languageCode: null}).toPromise();
|
|
|
|
|
if(result.result) {
|
|
|
|
|
this.movie.requested = true;
|
|
|
|
|
this.snackBar.open(result.message, "Ok", {
|
|
|
|
|
duration:3000
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.snackBar.open(result.errorMessage, "Ok", {
|
|
|
|
|
duration:3000,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public openDialog() {
|
|
|
|
|