My issue is that after login I navigate my page to dashboard page and the URL seems to be <http://localhost:4200/home> but when I change my URL to <http://localhost:4200> it shows me default Login page for some second and then after redirect to <http://localhost:4200/home>.

at time of login I used to generate the cookies and I want that login page should not display at all when cookies is available.

on app-routing.module.ts i have tried writing as 

```
const routes: Routes = [
  { path: 'login', component: LoginComponent },
  { path: 'home', component: LandingpageComponent, canActivate: [AuthGuard] },
  { path: '', redirectTo: '/login', pathMatch: 'full' },
  { path: '**', component: NotFoundComponent },
 ];

```

on AuthGuard I have written code as 

```
export class AuthGuard implements CanActivate {

constructor(
private router: Router,
private Cookie: CookieService,
private commonser: CommonService
 ) { }
 readonly LocalStName = require('proxy.config.json');
 GetlocalStoragePermissison: any = [];

 async canActivate(
 next: ActivatedRouteSnapshot,
 state: RouterStateSnapshot): Promise<boolean> {
 if (this.Cookie.getCookie('usertoken')) {
   if (CommonService.GlobalVar === undefined || CommonService.GlobalVar.length === 0) {
    await this.commonser.getuserpermisison();
  }
  if (CommonService.GlobalVar !== undefined && CommonService.GlobalVar.length > 0) {
    for (const a of CommonService.GlobalVar) {
      if (state.url.replace('/', '').toLowerCase() === a.permissionname) {
        return true;
      }
    }
  }
   return false;
  } else {
     this.router.navigate(['/login']);
      return false;
   }
 } 
}

```

the this.commonser.getuserpermisison(); code is as below 

```
async getuserpermisison() {
const data: any = await this.service.getuserpermisison();
if (data.length > 0) {
  data.push({
    isactive: 1,
    permissionid: null,
    permissionname: 'home',
    permissions: [2],
    total: 2,
    upmid: null
  }
  );
}
CommonService.GlobalVar = [];
this.SetlocalStoragePermissison = [];
for (const userper of data) {
  userper.permissionname = userper.permissionname.toLowerCase();
  if (userper.total > 0) {
    this.SetlocalStoragePermissison.push(Object.assign({}, userper));
  }
}
CommonService.GlobalVar = this.SetlocalStoragePermissison;
}

```

on login.component.ts after login click below code is written

```
onSubmit(form: NgForm) {
  this.submitted = true;
  if (form.invalid) {
   return;
 }
this.service.userlogin(form.value.Username, sha512.sha512(form.value.Password)).subscribe(
  async (data: any) => {
    this.Cookie.setCookie('usertoken', data.Token, 1);
    await this.appmethod.getuserpermisison();
    await this.appmethod.getdetails();
    await this.appmethod.callingmethod();
  }, (err: HttpErrorResponse) => {
    if (err.error.message != null) {
      this.commonser.openSnackBarError(err.error.message, 'X');
    } else {
      this.commonser.openSnackBarError(err.message.toString(), 'X');
    }
  });
}

```

The situation is that once I do successful login it redirect to home page and the URL is as <http://localhost:4200/home> but when I place URL <http://localhost:4200> it doesn't show login page, instead it directly redirect to home page