move user-password to Input decorator
This commit is contained in:
parent
a3342ce250
commit
2c2baef6f3
|
@ -88,4 +88,4 @@
|
||||||
<button (click)="resetPassword()" i18n>Ask for new password</button>
|
<button (click)="resetPassword()" i18n>Ask for new password</button>
|
||||||
|
|
||||||
<p class="mt-4" i18n>Manually set the user password</p>
|
<p class="mt-4" i18n>Manually set the user password</p>
|
||||||
<my-user-password></my-user-password>
|
<my-user-password userId="userId"></my-user-password>
|
||||||
|
|
|
@ -19,10 +19,11 @@ import { FormReactive } from '../../../shared'
|
||||||
})
|
})
|
||||||
export class UserPasswordComponent extends FormReactive implements OnInit, OnDestroy {
|
export class UserPasswordComponent extends FormReactive implements OnInit, OnDestroy {
|
||||||
error: string
|
error: string
|
||||||
userId: number
|
|
||||||
username: string
|
username: string
|
||||||
showPassword = false
|
showPassword = false
|
||||||
|
|
||||||
|
@Input() userId: number
|
||||||
|
|
||||||
private paramsSub: Subscription
|
private paramsSub: Subscription
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
|
@ -43,15 +44,6 @@ export class UserPasswordComponent extends FormReactive implements OnInit, OnDes
|
||||||
this.buildForm({
|
this.buildForm({
|
||||||
password: this.userValidatorsService.USER_PASSWORD
|
password: this.userValidatorsService.USER_PASSWORD
|
||||||
})
|
})
|
||||||
|
|
||||||
this.paramsSub = this.route.params.subscribe(routeParams => {
|
|
||||||
const userId = routeParams['id']
|
|
||||||
this.userService.getUser(userId).subscribe(
|
|
||||||
user => this.onUserFetched(user),
|
|
||||||
|
|
||||||
err => this.error = err.message
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy () {
|
ngOnDestroy () {
|
||||||
|
|
Loading…
Reference in New Issue