import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
-import { ModalDirective } from 'ng2-bootstrap/modal';
+import { ModalDirective } from 'ngx-bootstrap/modal';
+import { NotificationsService } from 'angular2-notifications';
import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared';
import { Video, VideoService } from '../shared';
constructor(
private formBuilder: FormBuilder,
- private videoAbuseService: VideoAbuseService
+ private videoAbuseService: VideoAbuseService,
+ private notificationsService: NotificationsService
) {
super();
}
}
report() {
- const reason = this.form.value['reason']
+ const reason = this.form.value['reason'];
this.videoAbuseService.reportVideo(this.video.id, reason)
- .subscribe(
- // TODO: move alert to beautiful notifications
- ok => {
- alert('Video reported.');
- this.hide();
- },
+ .subscribe(
+ () => {
+ this.notificationsService.success('Success', 'Video reported.');
+ this.hide();
+ },
- err => alert(err.text)
- )
+ err => this.notificationsService.error('Error', err.text)
+ );
}
}