title: How to stop my angular application from logging out after page reload
body: <p>I am using auth gaurd to prevent URL manipulation in my angular application and redirecting URL manipulation to login page. But it is causing a problem and that is even after successful login, on refreshing the webpage it considers it as URL manipulation and logs the user out by redirecting to the login page.Please note I am not using JWT or any similar kind of authenication mechanism. It's a vanilla authentication based on password returned by the backend DB.I am aslo not mantaining any session till now. Below I am attaching the snippet where I have mapped the path to the routes :</p>
  
  <pre><code>const appRoutes: Routes = [
    { path: '', component: LoginComponent },
    { path: 'dashboard', canActivate: [AuthGuard], component: DashboardComponent },
    { path: 'file-uploader', canActivate: [AuthGuard], component: FileUploaderComponent },
    { path: 'register', component: RegisterComponent },
    { path: 'login', component: LoginComponent }
   ];
  
  
  @Injectable()
  export class AuthGuard implements CanActivate {
    constructor(private user: UserService, private router: Router) {}
    canActivate() {
      if (this.user.getUserLoggedIn()) {
            return true;
      }
      else
        return false;
    }
  }
  </code></pre>
  
  <p>Please help me resolve this issue.Thanks in advance.</p>