Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getReview(id?: number) {
- this.previousReviewId = this.nextReviewId = 0;
- if (this.review.isCompleted) {
- this.updateReview(this.review)
- .then(() => {
- this.reviewService.getReview(id).subscribe(review => {
- if (this.fromReviewList && this.review.id != null) {
- this.fromReviewList = false;
- }
- this.review = null;
- this.review = this.mapReview(review);
- this.previousReviewId = review.previousId;
- this.nextReviewId = review.nextId;
- });
- });
- }
- else {
- this.reviewService.getReview(id).subscribe(review => {
- if (this.fromReviewList && this.review.id != null) {
- this.fromReviewList = false;
- }
- this.review = null;
- this.review = this.mapReview(review);
- this.previousReviewId = review.previousId;
- this.nextReviewId = review.nextId;
- });
- }
- }
- updateReview(review: Review): Promise<void> {
- return Promise<void>(resolve => {
- if (this.review && this.review.id) {
- this.reviewService.updateReview(this.review)
- .takeUntil(this.componetDestroyed$)
- .subscribe(() => {
- resolve(null);
- });
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement