From 828a466da7afffed48e4110cd4daee3bff1bff80 Mon Sep 17 00:00:00 2001 From: Emil Abraham Date: Tue, 30 Apr 2019 09:52:39 -0400 Subject: [PATCH] added redirect to dashboard page if loggedin --- src/app/app.component.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9d6b2f1..31148b5 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { Router } from '@angular/router'; @Component({ selector: 'app-root', @@ -7,4 +8,10 @@ import { Component } from '@angular/core'; }) export class AppComponent { title = 'frontend'; + + constructor(router: Router) { + if (localStorage.getItem('auth_token') !== null && router.url == '/') { + router.navigate(['/generator-search']); + } + } }