Skip to content

Commit

Permalink
fix(users-config): fix dataflow logical error
Browse files Browse the repository at this point in the history
  • Loading branch information
ElonH committed Jun 3, 2020
1 parent 9a67874 commit 3ca1458
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/app/pages/user/config/config.component.ts
Expand Up @@ -7,8 +7,8 @@ import {
Output,
} from '@angular/core';
import { FormControl } from '@angular/forms';
import { Observable, Subject } from 'rxjs';
import { map, withLatestFrom } from 'rxjs/operators';
import { combineLatest, Observable, Subject } from 'rxjs';
import { map } from 'rxjs/operators';
import { CombErr, NothingFlow } from '../../../@dataflow/core';
import { IRcloneServer, IUser } from '../../../@dataflow/extra';
import { NoopAuthFlow } from '../../../@dataflow/rclone';
Expand Down Expand Up @@ -161,19 +161,18 @@ export class ConfigComponent implements OnInit {
const user = node[0];
this.setUser(user.name, user.url, user.user, user.password);
});
this.name.valueChanges
.pipe(
withLatestFrom(users$, sec$) // TODO: some wrong in users$
)
.subscribe(([name, usersNode, secNode]) => {
combineLatest([this.name.valueChanges, users$, sec$]).subscribe(
([name, usersNode, secNode]) => {
// TODO: some wrong in users$
if (usersNode[1].length !== 0 || secNode[1].length !== 0)
this.nameErr = usersNode[1][0].message;
else if (name === '') this.nameErr = 'You must enter a value';
else if (usersNode[0].users.find(x => x.name !== secNode[0].name && x.name === name))
this.nameErr = 'This name already exists';
else this.nameErr = '';
// this.disableSave = this.nameErr !== '';
});
}
);

this.url.valueChanges.subscribe(x => {
this.urlErr = x === '' ? 'You must enter a value' : '';
Expand Down

0 comments on commit 3ca1458

Please sign in to comment.