|
|
@ -15,6 +15,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
import { comparePasswords } from '@ngx-validate/core'; |
|
|
import { comparePasswords } from '@ngx-validate/core'; |
|
|
import { Store } from '@ngxs/store'; |
|
|
import { Store } from '@ngxs/store'; |
|
|
import snq from 'snq'; |
|
|
import snq from 'snq'; |
|
|
|
|
|
import { finalize } from 'rxjs/operators'; |
|
|
|
|
|
|
|
|
const { minLength, required } = Validators; |
|
|
const { minLength, required } = Validators; |
|
|
|
|
|
|
|
|
@ -43,6 +44,8 @@ export class ChangePasswordComponent implements OnInit, OnChanges { |
|
|
|
|
|
|
|
|
form: FormGroup; |
|
|
form: FormGroup; |
|
|
|
|
|
|
|
|
|
|
|
modalBusy: boolean = false; |
|
|
|
|
|
|
|
|
constructor(private fb: FormBuilder, private store: Store, private toasterService: ToasterService) {} |
|
|
constructor(private fb: FormBuilder, private store: Store, private toasterService: ToasterService) {} |
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
ngOnInit(): void { |
|
|
@ -60,6 +63,7 @@ export class ChangePasswordComponent implements OnInit, OnChanges { |
|
|
|
|
|
|
|
|
onSubmit() { |
|
|
onSubmit() { |
|
|
if (this.form.invalid) return; |
|
|
if (this.form.invalid) return; |
|
|
|
|
|
this.modalBusy = true; |
|
|
|
|
|
|
|
|
this.store |
|
|
this.store |
|
|
.dispatch( |
|
|
.dispatch( |
|
|
@ -68,6 +72,11 @@ export class ChangePasswordComponent implements OnInit, OnChanges { |
|
|
newPassword: this.form.get('newPassword').value, |
|
|
newPassword: this.form.get('newPassword').value, |
|
|
}), |
|
|
}), |
|
|
) |
|
|
) |
|
|
|
|
|
.pipe( |
|
|
|
|
|
finalize(() => { |
|
|
|
|
|
this.modalBusy = false; |
|
|
|
|
|
}), |
|
|
|
|
|
) |
|
|
.subscribe({ |
|
|
.subscribe({ |
|
|
next: () => { |
|
|
next: () => { |
|
|
this.visible = false; |
|
|
this.visible = false; |
|
|
|