|
|
@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core'; |
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
import { Observable } from 'rxjs'; |
|
|
import { Observable } from 'rxjs'; |
|
|
import { take, withLatestFrom } from 'rxjs/operators'; |
|
|
import { take, withLatestFrom, finalize } from 'rxjs/operators'; |
|
|
import { ToasterService } from '@abp/ng.theme.shared'; |
|
|
import { ToasterService } from '@abp/ng.theme.shared'; |
|
|
|
|
|
|
|
|
const { maxLength, required, email } = Validators; |
|
|
const { maxLength, required, email } = Validators; |
|
|
@ -18,8 +18,14 @@ export class PersonalSettingsComponent implements OnInit { |
|
|
|
|
|
|
|
|
form: FormGroup; |
|
|
form: FormGroup; |
|
|
|
|
|
|
|
|
|
|
|
inProgress: boolean; |
|
|
|
|
|
|
|
|
constructor(private fb: FormBuilder, private store: Store, private toasterService: ToasterService) {} |
|
|
constructor(private fb: FormBuilder, private store: Store, private toasterService: ToasterService) {} |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
|
|
|
this.buildForm(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
buildForm() { |
|
|
buildForm() { |
|
|
this.store |
|
|
this.store |
|
|
.dispatch(new GetProfile()) |
|
|
.dispatch(new GetProfile()) |
|
|
@ -40,13 +46,12 @@ export class PersonalSettingsComponent implements OnInit { |
|
|
|
|
|
|
|
|
submit() { |
|
|
submit() { |
|
|
if (this.form.invalid) return; |
|
|
if (this.form.invalid) return; |
|
|
|
|
|
this.inProgress = true; |
|
|
this.store.dispatch(new UpdateProfile(this.form.value)).subscribe(() => { |
|
|
this.store |
|
|
this.toasterService.success('AbpAccount::PersonalSettingsSaved', 'Success', { life: 5000 }); |
|
|
.dispatch(new UpdateProfile(this.form.value)) |
|
|
}); |
|
|
.pipe(finalize(() => (this.inProgress = false))) |
|
|
} |
|
|
.subscribe(() => { |
|
|
|
|
|
this.toasterService.success('AbpAccount::PersonalSettingsSaved', 'Success', { life: 5000 }); |
|
|
ngOnInit() { |
|
|
}); |
|
|
this.buildForm(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|