Onboarding
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { Component, OnInit, inject, signal } from '@angular/core';
|
||||
import { BreakpointObserver } from '@angular/cdk/layout';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
||||
@@ -9,6 +9,7 @@ import { MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { map } from 'rxjs';
|
||||
import { AuthService } from './auth/auth.service';
|
||||
import { OnboardingOverlayComponent } from './onboarding/onboarding-overlay.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -21,11 +22,12 @@ import { AuthService } from './auth/auth.service';
|
||||
MatListModule,
|
||||
MatSidenavModule,
|
||||
MatToolbarModule,
|
||||
OnboardingOverlayComponent,
|
||||
],
|
||||
templateUrl: './app.html',
|
||||
styleUrl: './app.scss'
|
||||
})
|
||||
export class App {
|
||||
export class App implements OnInit {
|
||||
protected readonly auth = inject(AuthService);
|
||||
private readonly breakpointObserver = inject(BreakpointObserver);
|
||||
|
||||
@@ -35,6 +37,12 @@ export class App {
|
||||
);
|
||||
protected readonly sidebarOpened = signal(false);
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.auth.isAuthenticated()) {
|
||||
this.auth.loadCurrentUser().subscribe({ error: () => undefined });
|
||||
}
|
||||
}
|
||||
|
||||
protected toggleSidebar(): void {
|
||||
this.sidebarOpened.update((opened) => !opened);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user