export class AccountDetailsComponent extends FormReactive implements OnInit {
@Input() user: User = null
- error: string = null
-
form: FormGroup
formErrors = {}
validationMessages = {}
buildForm () {
this.form = this.formBuilder.group({
- displayNSFW: [ this.user.displayNSFW ]
+ nsfwPolicy: [ this.user.nsfwPolicy ],
+ autoPlayVideo: [ this.user.autoPlayVideo ]
})
this.form.valueChanges.subscribe(data => this.onValueChanged(data))
}
updateDetails () {
- const displayNSFW = this.form.value['displayNSFW']
+ const nsfwPolicy = this.form.value['nsfwPolicy']
+ const autoPlayVideo = this.form.value['autoPlayVideo']
const details: UserUpdateMe = {
- displayNSFW
+ nsfwPolicy,
+ autoPlayVideo
}
- this.error = null
this.userService.updateMyDetails(details).subscribe(
() => {
this.notificationsService.success('Success', 'Information updated.')
this.authService.refreshUserInformation()
},
- err => this.error = err.message
+ err => this.notificationsService.error('Error', err.message)
)
}
}