File size: 542 Bytes
e4ab6d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { Component } from '@angular/core';
import { AuthService } from './auth/auth.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrl: './app.component.css'
})
export class AppComponent {
  constructor(private authService: AuthService) { }
  title = 'Py-Learn';

  ngOnInit(): void {
    this.authService.checkSession().subscribe((status) => {
      if (status) {
        this.authService.startAutoRefresh();  // ✅ Start auto-refresh once app loads and session is valid
      }
    });
  }
}