diff options
Diffstat (limited to 'ufund-ui/src/app/components/dashboard/dashboard.component.ts')
-rw-r--r-- | ufund-ui/src/app/components/dashboard/dashboard.component.ts | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.ts b/ufund-ui/src/app/components/dashboard/dashboard.component.ts index 165c7ba..645893f 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.ts +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.ts @@ -1,10 +1,8 @@ import {Component, OnInit} from '@angular/core'; -import {userType} from '../../models/User'; import {AuthService} from '../../services/auth.service'; import {Router} from '@angular/router'; import {Need} from '../../models/Need'; import {CupboardService} from '../../services/cupboard.service'; -import {UsersService} from '../../services/users.service'; import {firstValueFrom} from 'rxjs'; @Component({ @@ -27,7 +25,7 @@ export class DashboardComponent implements OnInit{ ngOnInit() { let user = this.authService.getCurrentUser() - if(!user) { + if(!localStorage.getItem("credential") && !user) { this.router.navigate(['/login']) return } @@ -35,7 +33,7 @@ export class DashboardComponent implements OnInit{ firstValueFrom(this.cupboardService.getNeeds()).then(r => { this.topNeeds = r.sort((a, b) => b.current - a.current) this.almostThere = r.sort((a, b) => a.current/a.maxGoal - b.current/b.maxGoal) - this.inBasket = r.filter(n => n.id in user?.basket) + this.inBasket = r.filter(n => n.id in user!.basket) }) } |