diff --git a/frontend/components/PostCard.vue b/frontend/components/PostCard.vue new file mode 100644 index 0000000..49bcd67 --- /dev/null +++ b/frontend/components/PostCard.vue @@ -0,0 +1,21 @@ + + + + + + + {{ props.title }} + + + {{ props.description }} + + + + diff --git a/frontend/composables/post.ts b/frontend/composables/post.ts new file mode 100644 index 0000000..c585dc8 --- /dev/null +++ b/frontend/composables/post.ts @@ -0,0 +1,22 @@ +import { z } from 'zod' + +const PostValidator = z.object({ + sequence: z.number(), + id: z.string(), + title: z.string(), + description: z.string().nullish(), + created_at: z.string(), + updated_at: z.string(), +}) + +const parsePost = (data: unknown) => { + return PostValidator.parse(data) +} + +const PostsValidator = PostValidator.array() + +const parsePosts = (data: unknown[]) => { + return PostsValidator.parse(data) +} + +export { parsePost, parsePosts, PostsValidator, PostValidator } diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue new file mode 100644 index 0000000..17eb28a --- /dev/null +++ b/frontend/pages/index.vue @@ -0,0 +1,41 @@ + + + + + + + + + + More {{ lastPost }} + + + +