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