diff --git a/frontend/src/pages/login/LogInIndex.tsx b/frontend/src/pages/login/LogInIndex.tsx index a7973bf..3d6bc2d 100644 --- a/frontend/src/pages/login/LogInIndex.tsx +++ b/frontend/src/pages/login/LogInIndex.tsx @@ -1,22 +1,59 @@ +import { SubmitHandler, useForm } from "react-hook-form"; +import z from "zod"; + +import { CreatePost } from "../../dto"; +import { useNotes, usePostNoteMutation } from "../../queries/note"; + export function LogInIndexPage() { - const notes = new Array(40).fill("foobar"); // TODO: stub + const { data: notes } = useNotes(); + const { register, handleSubmit, reset } = + useForm>(); + const { + mutate: postNote, + isLoading, + error, + } = usePostNoteMutation(() => { + reset(); + }); + + const onSubmit: SubmitHandler> = (data) => { + postNote(data); + }; return (
- {notes.map((note, i) => ( -
-
- {note} {i} -
+ {(notes ?? []).map((note) => ( +
+ {note.user && ( +
+ {note.user.name != null ? ( + + {note.user.name} + + @{note.user.handle} + + + ) : ( + @{note.user.handle} + )} +
+ )} +
{note.text}
))}
-
+ +