|
|
@ -1,9 +1,9 @@
|
|
|
|
import { Component } from "@angular/core";
|
|
|
|
import { Component } from "@angular/core";
|
|
|
|
import { ImageService, SearchV2Service } from "../services";
|
|
|
|
import { ImageService, SearchV2Service, RequestService } from "../services";
|
|
|
|
import { ActivatedRoute } from "@angular/router";
|
|
|
|
import { ActivatedRoute } from "@angular/router";
|
|
|
|
import { DomSanitizer } from "@angular/platform-browser";
|
|
|
|
import { DomSanitizer } from "@angular/platform-browser";
|
|
|
|
import { ISearchMovieResultV2 } from "../interfaces/ISearchMovieResultV2";
|
|
|
|
import { ISearchMovieResultV2 } from "../interfaces/ISearchMovieResultV2";
|
|
|
|
import { MatDialog } from "@angular/material";
|
|
|
|
import { MatDialog, MatSnackBar } from "@angular/material";
|
|
|
|
import { MovieDetailsTrailerComponent } from "./movie-details-trailer.component";
|
|
|
|
import { MovieDetailsTrailerComponent } from "./movie-details-trailer.component";
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
@ -16,7 +16,8 @@ export class MovieDetailsComponent {
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
|
|
|
|
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
|
|
|
|
private sanitizer: DomSanitizer, private imageService: ImageService,
|
|
|
|
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.route.params.subscribe((params: any) => {
|
|
|
|
this.theMovidDbId = params.movieDbId;
|
|
|
|
this.theMovidDbId = params.movieDbId;
|
|
|
|
this.load();
|
|
|
|
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() {
|
|
|
|
public openDialog() {
|
|
|
|