diff --git a/src/MistoxWebsite.Client/src/app/pages/store/admin/newitem/new.component.ts b/src/MistoxWebsite.Client/src/app/pages/store/admin/newitem/new.component.ts index 4ed86c8..cd1b6d0 100644 --- a/src/MistoxWebsite.Client/src/app/pages/store/admin/newitem/new.component.ts +++ b/src/MistoxWebsite.Client/src/app/pages/store/admin/newitem/new.component.ts @@ -22,10 +22,15 @@ export class NewItemComponent { constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) { this.title.setTitle("New | ADMIN"); - if (auth.isLoggedIn){ - if (auth.loggedInUser.siteData.role != "Admin"){ - router.navigate(["/"]); - } + + // If user is not logged in -> route home + if (!auth.isLoggedIn){ + router.navigate(["/"]); + } + + // If user is not Admin -> route home + if (auth.loggedInUser.siteData.role != "Admin"){ + router.navigate(["/"]); } };