fix: eslint
This commit is contained in:
parent
d569f35bc1
commit
df5bba022e
@ -1,6 +1,9 @@
|
||||
import { CreatePostRequestDto } from '$lib/post/adapter/gateway/creatPostRequestDto';
|
||||
import type { PostApiService } from '$lib/post/adapter/gateway/postApiService';
|
||||
import type { CreatePostParams, PostRepository } from '$lib/post/application/gateway/postRepository';
|
||||
import type {
|
||||
CreatePostParams,
|
||||
PostRepository,
|
||||
} from '$lib/post/application/gateway/postRepository';
|
||||
import type { Post } from '$lib/post/domain/entity/post';
|
||||
import type { PostInfo } from '$lib/post/domain/entity/postInfo';
|
||||
|
||||
|
@ -38,8 +38,7 @@ export class PostBloc {
|
||||
case PostEventType.PostLoadedEvent:
|
||||
return this.loadPost(event.id);
|
||||
case PostEventType.PostCreatedEvent:
|
||||
const { semanticId, title } = event;
|
||||
return this.createPost({ semanticId, title });
|
||||
return this.createPost(event.params);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,6 +94,5 @@ interface PostLoadedEvent {
|
||||
|
||||
interface PostCreatedEvent {
|
||||
event: PostEventType.PostCreatedEvent;
|
||||
semanticId: string;
|
||||
title: string;
|
||||
params: CreatePostParams;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
.string()
|
||||
.max(100)
|
||||
.regex(/\D/)
|
||||
.regex(/^[a-zA-Z0-9_\-]+$/),
|
||||
.regex(/^[a-zA-Z0-9_-]+$/),
|
||||
title: z.string().trim().nonempty().max(100),
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { StatusType } from '$lib/common/adapter/presenter/asyncState';
|
||||
import { PostBloc, PostEventType } from '$lib/post/adapter/presenter/postBloc';
|
||||
import CreatePostDialog, {
|
||||
@ -14,7 +13,7 @@
|
||||
const isLoading = $derived(state.status === StatusType.Loading);
|
||||
|
||||
async function onCreatePostDialogSubmit(params: CreatePostDialogFormParams) {
|
||||
const state = await postBloc.dispatch({ event: PostEventType.PostCreatedEvent, ...params });
|
||||
const state = await postBloc.dispatch({ event: PostEventType.PostCreatedEvent, params });
|
||||
|
||||
if (state.status === StatusType.Success) {
|
||||
toast.success(`Post created successfully with ID: ${state.data.id}`);
|
||||
|
@ -36,7 +36,7 @@
|
||||
{:else if !isAuthenticated}
|
||||
<ErrorPage />
|
||||
{:else}
|
||||
<div class="min-h-content-height grid grid-cols-[auto_1fr]">
|
||||
<div class="grid min-h-content-height grid-cols-[auto_1fr]">
|
||||
<DashboardNavbar {links} />
|
||||
{@render children()}
|
||||
</div>
|
||||
|
@ -4,9 +4,9 @@
|
||||
import PostManagementPage from '$lib/post/framework/ui/PostManagementPage.svelte';
|
||||
import { getContext, setContext } from 'svelte';
|
||||
|
||||
const container = getContext<Container>(Container.name);
|
||||
const postBloc = container.createPostBloc();
|
||||
setContext(PostBloc.name, postBloc);
|
||||
const container = getContext<Container>(Container.name);
|
||||
const postBloc = container.createPostBloc();
|
||||
setContext(PostBloc.name, postBloc);
|
||||
</script>
|
||||
|
||||
<PostManagementPage />
|
||||
|
Loading…
x
Reference in New Issue
Block a user