added create page and updated auth

This commit is contained in:
u80864958
2025-04-28 11:32:26 +02:00
parent efe902639e
commit 4429f2670c
16 changed files with 242 additions and 30 deletions

View File

@ -0,0 +1,36 @@
import { Component, effect, inject, signal } from '@angular/core';
import { PostEditorComponent } from '../../../components/post-editor/post-editor.component';
import { Post } from '../../../shared/interfaces/post';
import { PostsService } from '../../../shared/services/posts.service';
import { Location } from '@angular/common';
@Component({
selector: 'app-create-post',
imports: [PostEditorComponent],
templateUrl: './create-post.component.html',
})
export class CreatePostComponent {
private postsService = inject(PostsService);
private location = inject(Location);
post = signal<Post>({
id: 0,
title: '',
tldr: '',
content: '',
});
constructor() {
effect(() => {
console.log('create', this.post());
});
setTimeout(() => {
this.post.set({ ...this.post(), title: 'adf' });
}, 1000);
}
publish() {
this.postsService.createPost(this.post());
this.location.back();
}
}