Unverified Commit d48fa086 authored by Ruslan Konviser's avatar Ruslan Konviser Committed by GitHub
Browse files

Merge pull request #1106 from ever-co/fix/#1105-admin-profile-page-error

fix: view admin profile page error
parents 52fcc544 ec3deedb
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ import {
} from '@angular/forms';
import Admin from '@modules/server.common/entities/Admin';
import { AdminsService } from '../../../../@core/data/admins.service';
import { first, takeUntil } from 'rxjs/operators';
import { first, takeUntil, debounceTime } from 'rxjs/operators';
import { ToasterService } from 'angular2-toaster';
import { Router } from '@angular/router';
import { Subject } from 'rxjs';
@@ -133,8 +133,7 @@ export class AccountComponent implements OnInit, OnDestroy {
	private validations = {
		oldPasswordControl: () => {
			this.oldPassword.valueChanges
				.debounceTime(500)
				.pipe(takeUntil(this.ngDestroy$))
				.pipe(debounceTime(500), takeUntil(this.ngDestroy$))
				.subscribe((value) => {
					this.oldPasswordErrorMsg =
						(this.oldPassword.touched || this.oldPassword.dirty) &&
@@ -145,8 +144,7 @@ export class AccountComponent implements OnInit, OnDestroy {
		},
		passwordControl: () => {
			this.password.valueChanges
				.debounceTime(500)
				.pipe(takeUntil(this.ngDestroy$))
				.pipe(debounceTime(500), takeUntil(this.ngDestroy$))
				.subscribe((value) => {
					this.passwordErrorMsg =
						(this.password.touched || this.password.dirty) &&
@@ -157,8 +155,7 @@ export class AccountComponent implements OnInit, OnDestroy {
		},
		repeatPasswordControl: () => {
			this.repeatPassword.valueChanges
				.debounceTime(500)
				.pipe(takeUntil(this.ngDestroy$))
				.pipe(debounceTime(500), takeUntil(this.ngDestroy$))
				.subscribe((value) => {
					this.repeatPasswordErrorMsg =
						(this.repeatPassword.touched ||
+5 −9
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ import {
	Validators,
} from '@angular/forms';
import Admin from '@modules/server.common/entities/Admin';
import { takeUntil, first } from 'rxjs/operators';
import { takeUntil, first, debounceTime } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { IAdminUpdateObject } from '@modules/server.common/interfaces/IAdmin';
import { AdminsService } from '../../../../@core/data/admins.service';
@@ -154,8 +154,7 @@ export class BasicInfoComponent implements OnChanges, OnDestroy {
	private validations = {
		usernameControl: () => {
			this.username.valueChanges
				.debounceTime(500)
				.pipe(takeUntil(this.ngDestroy$))
				.pipe(debounceTime(500), takeUntil(this.ngDestroy$))
				.subscribe((value) => {
					this.usernameErrorMsg = this.hasError(this.username)
						? Object.keys(this.username.errors)[0]
@@ -164,8 +163,7 @@ export class BasicInfoComponent implements OnChanges, OnDestroy {
		},
		emailControl: () => {
			this.email.valueChanges
				.debounceTime(500)
				.pipe(takeUntil(this.ngDestroy$))
				.pipe(debounceTime(500), takeUntil(this.ngDestroy$))
				.subscribe((value) => {
					this.emailErrorMsg = this.hasError(this.email)
						? this.email.errors.email
@@ -176,8 +174,7 @@ export class BasicInfoComponent implements OnChanges, OnDestroy {
		},
		firstNameControl: () => {
			this.firstName.valueChanges
				.debounceTime(500)
				.pipe(takeUntil(this.ngDestroy$))
				.pipe(debounceTime(500), takeUntil(this.ngDestroy$))
				.subscribe((value) => {
					this.firstNameErrorMsg = this.hasError(this.firstName)
						? this.firstName.errors.pattern
@@ -188,8 +185,7 @@ export class BasicInfoComponent implements OnChanges, OnDestroy {
		},
		lastNameControl: () => {
			this.lastName.valueChanges
				.debounceTime(500)
				.pipe(takeUntil(this.ngDestroy$))
				.pipe(debounceTime(500), takeUntil(this.ngDestroy$))
				.subscribe((value) => {
					this.lastNameErrorMsg = this.hasError(this.lastName)
						? this.lastName.errors.pattern