-
Notifications
You must be signed in to change notification settings - Fork 0
/
episode_reviews.component.ts
48 lines (38 loc) · 1.35 KB
/
episode_reviews.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Component, OnInit } from '@angular/core';
import { WebService } from '../web.service';
import { ActivatedRoute } from '@angular/router';
import { FormBuilder, Validators } from '@angular/forms';
import { AuthService } from '@auth0/auth0-angular';
@Component({
selector: 'episodeReviews',
templateUrl: './episode_reviews.component.html',
styleUrls: ['./episode_reviews.component.css']
})
export class EpisodeReviewsComponent {
updatedReview;
episodes_list: any = [];
reviews: any=[];
newReview
constructor(public webService: WebService,
private route: ActivatedRoute,
public formBuilder: FormBuilder,
public authService: AuthService){}
ngOnInit(){
this.webService.getReviews(this.route.snapshot.params.id)
this.updatedReview = this.formBuilder.group({
rating: ["", Validators.required],
review: ["", Validators.required]
});
}
DeleteReview(review){
this.webService.deleteReview(review._id);
this.webService.getReviews(this.route.snapshot.params.id);
window.location.reload
}
updatedSubmit(review_id) {
this.webService.updateReview(this.updatedReview.value, review_id)
this.webService.getReviews(this.route.snapshot.params.id);
window.location.reload
// this.webService.getReviews(this.route.snapshot.params.id)
}
}