move user-password to Input decorator

This commit is contained in:
Rigel Kent 2018-10-08 21:05:57 +02:00 committed by Chocobozzz
parent a3342ce250
commit 2c2baef6f3
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 3 additions and 11 deletions

View File

@ -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>

View File

@ -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 () {