Skip to content

Commit

Permalink
Si existe una sesion dentro de la app no permite ir al login o al reg…
Browse files Browse the repository at this point in the history
…ister
  • Loading branch information
matias1305 committed Dec 8, 2018
1 parent 1281d28 commit c07d5a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/app/pages/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class HomeComponent implements OnInit {

constructor( private _dbService:DatabaseService, private route:Router ) {
const UID = JSON.parse(localStorage.getItem('user')).uid;
console.log(UID);

this._dbService.getDataQuery('books', 'status', '==', 'available')
.valueChanges()
Expand Down
2 changes: 2 additions & 0 deletions src/app/register/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export class LoginComponent implements OnInit {
private router:Router,
private _db:DatabaseService ) {

if( JSON.parse(localStorage.getItem('session')).session ) router.navigate(['/']);

this.afAuth.authState.subscribe( user => {
console.log( 'Estado del usuario', user );
if( !user ){
Expand Down
4 changes: 3 additions & 1 deletion src/app/register/register.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export class RegisterComponent implements OnInit {
constructor( private _dbService:DatabaseService,
private _dateService:DateService,
private afAuth: AngularFireAuth,
public router: Router ) { }
public router: Router ) {
if( JSON.parse(localStorage.getItem('session')).session ) router.navigate(['/']);
}

ngOnInit() {
init_plugins();
Expand Down

0 comments on commit c07d5a0

Please sign in to comment.