diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d4cf93d4..d3d63149 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -108,7 +108,6 @@ export class AppComponent implements OnInit, AfterViewInit { } ngOnInit(): void { - this.authService.autoLogin(); this.authService.isLogged.subscribe((status) => { this.isLogged = status; if (status) { diff --git a/src/app/core/_services/app-init.service.ts b/src/app/core/_services/app-init.service.ts index aaa6f1b1..d84da48a 100644 --- a/src/app/core/_services/app-init.service.ts +++ b/src/app/core/_services/app-init.service.ts @@ -1,34 +1,15 @@ -import { firstValueFrom } from 'rxjs'; -import { take } from 'rxjs/operators'; - import { Injectable } from '@angular/core'; import { AuthService } from '@services/access/auth.service'; -import { PermissionService } from '@services/permission/permission.service'; -import { AlertService } from '@services/shared/alert.service'; @Injectable({ providedIn: 'root' }) export class AppInitService { - constructor( - private permissionService: PermissionService, - private auth: AuthService, - private alertService: AlertService - ) {} + constructor(private auth: AuthService) {} /** * Call this on app start to ensure permissions are loaded, if user is already logged in */ - async initializeApp(): Promise { - try { - const isLoggedIn = this.auth.token !== 'notoken'; - - if (isLoggedIn) { - await firstValueFrom(this.permissionService.loadPermissions().pipe(take(1))); - } - } catch (err) { - console.error('Error during app initialization:', err); - this.alertService.showErrorMessage('Failed to initialize application permissions.'); - throw err; - } + initializeApp() { + this.auth.autoLogin(); } }