Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- checkAllowEmail(control: FormControl) {
- this.userService.getUserByEmail(control.value)
- .subscribe((user: UserDto) => {
- console.log(user);
- if (user !== undefined) {
- console.log(this.isAllowEmail);
- this.isAllowEmail = false;
- console.log(this.isAllowEmail);
- }
- });
- }
- getUserByEmail(email: string): Observable<UserDto> {
- return this.http.get(`http://localhost:9092/api/v1/users?email=${email}`)
- .map((response: Response) => response.json())
- .map((user: UserDto) => user ? user : undefined);
- }
- export class UserDto {
- constructor(
- public email: string,
- public name: string,
- public role: string
- ) {}
- }
- {"name":"art","email":"art@mail.ru","role":"user"}
Add Comment
Please, Sign In to add comment