- Timestamp:
- 12/28/21 08:56:55 (3 years ago)
- Branches:
- master
- Children:
- b738035
- Parents:
- 84d0fbb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/homepage/homepage.component.ts
r84d0fbb rbdd6491 1 import { HttpErrorResponse } from '@angular/common/http'; 1 2 import { Component, OnInit } from '@angular/core'; 2 3 import { Router } from '@angular/router'; … … 50 51 51 52 ngOnInit(): void { 52 /*53 53 this.locationService.getWeekendGetaways().subscribe( 54 54 data => { … … 61 61 } 62 62 ); 63 */ 63 64 64 } 65 65 … … 73 73 74 74 this.ref.onClose.subscribe((user: UserDto) => { 75 this.userService.registerUser(user).subscribe( 76 data => { 77 console.log(data); 78 79 } 80 ); 81 }); 75 if (user) { 76 this.userService.registerUser(user).subscribe( 77 data => { 78 console.log(data); 79 } 80 ); 81 } 82 }, 83 err => { 84 85 }); 82 86 } 83 87 84 88 85 89 onClickLogIn() { 86 90 this.ref = this.dialogService.open(LoginComponent, { … … 90 94 baseZIndex: 10000 91 95 }); 92 this.ref.onClose.subscribe((loginRequest : LoginRequest) => { 93 this.userService.authenticateUser(loginRequest).subscribe( 94 (data : any) => { 95 console.log(data); 96 if(this.userService.isUserLoggedIn()){ 97 this.router.navigate(['planners']); 96 this.ref.onClose.subscribe((loginRequest: LoginRequest) => { 97 if (loginRequest) { 98 this.userService.authenticateUser(loginRequest).subscribe( 99 (data: any) => { 100 console.log(data); 101 if (this.userService.isUserLoggedIn()) { 102 this.router.navigate(['planners']); 103 } 98 104 } 99 }100 );105 ); 106 } 101 107 }); 102 108 } 109 110 ngOnDestroy() { 111 if (this.ref) { 112 this.ref.close(); 113 } 114 } 103 115 }
Note:
See TracChangeset
for help on using the changeset viewer.