import { Component, Input, OnInit } from '@angular/core'
-import { NotificationsService } from 'angular2-notifications'
+import { Notifier } from '@app/core'
import { UserUpdateMe } from '../../../../../../shared'
import { AuthService } from '../../../core'
import { FormReactive, User, UserService } from '../../../shared'
constructor (
protected formValidatorService: FormValidatorService,
private authService: AuthService,
- private notificationsService: NotificationsService,
+ private notifier: Notifier,
private userService: UserService,
private i18n: I18n
) {
ngOnInit () {
this.buildForm({
nsfwPolicy: null,
- webTorrentPolicy: null,
+ webTorrentEnabled: null,
autoPlayVideo: null
})
this.userInformationLoaded.subscribe(() => {
this.form.patchValue({
nsfwPolicy: this.user.nsfwPolicy,
- webTorrentPolicy: this.user.webTorrentPolicy,
+ webTorrentEnabled: this.user.webTorrentEnabled,
autoPlayVideo: this.user.autoPlayVideo === true
})
})
updateDetails () {
const nsfwPolicy = this.form.value['nsfwPolicy']
- const webTorrentPolicy = this.form.value['webTorrentPolicy']
+ const webTorrentEnabled = this.form.value['webTorrentEnabled']
const autoPlayVideo = this.form.value['autoPlayVideo']
const details: UserUpdateMe = {
nsfwPolicy,
- webTorrentPolicy,
+ webTorrentEnabled,
autoPlayVideo
}
this.userService.updateMyProfile(details).subscribe(
() => {
- this.notificationsService.success(this.i18n('Success'), this.i18n('Information updated.'))
+ this.notifier.success(this.i18n('Information updated.'))
this.authService.refreshUserInformation()
},
- err => this.notificationsService.error(this.i18n('Error'), err.message)
+ err => this.notifier.error(err.message)
)
}
}