started with post editor

This commit is contained in:
u80864958
2025-04-11 15:38:04 +02:00
parent fb2d784421
commit efe902639e
29 changed files with 387 additions and 16 deletions

View File

@ -1,11 +1,39 @@
import { Component } from '@angular/core';
import {
Component,
computed,
effect,
inject,
OnChanges,
SimpleChanges,
} from '@angular/core';
import { RouterLink, RouterOutlet } from '@angular/router';
import { ModalComponent } from './components/modal/modal.component';
import { LoginComponent } from './components/login/login.component';
import { AuthService } from './shared/services/auth.service';
import { NgIf } from '@angular/common';
@Component({
selector: 'app-root',
imports: [RouterOutlet, RouterLink],
imports: [RouterOutlet, RouterLink, ModalComponent, LoginComponent, NgIf],
templateUrl: './app.component.html',
})
export class AppComponent {
title = 'frontend';
private auth = inject(AuthService);
loginOpen: boolean = false;
loggedIn = computed(() => this.auth.jwt() !== null);
constructor() {
effect(() => {
if (this.auth.jwt()) {
this.loginOpen = false;
}
});
}
toggleLogin() {
this.loginOpen = !this.loginOpen;
}
logOut() {
this.auth.jwt.set(null);
}
}