From 6bef5ada4da3fe41348376774570e9effa667670 Mon Sep 17 00:00:00 2001 From: Imbus Date: Fri, 27 Oct 2023 16:04:58 +0200 Subject: [PATCH] Individual posts working --- client-solid/src/Navbar.tsx | 2 +- client-solid/src/Posts.tsx | 12 ++++-- client-solid/src/Primary.tsx | 3 ++ client-solid/src/Root.tsx | 73 +++++++++++++++++++++------------ client-solid/src/SinglePost.tsx | 19 +++++++++ client-solid/src/api.ts | 5 ++- 6 files changed, 80 insertions(+), 34 deletions(-) create mode 100644 client-solid/src/SinglePost.tsx diff --git a/client-solid/src/Navbar.tsx b/client-solid/src/Navbar.tsx index 9902fda..ca5e4b8 100644 --- a/client-solid/src/Navbar.tsx +++ b/client-solid/src/Navbar.tsx @@ -32,7 +32,7 @@ export function Navbar() { return ( }> +
+ + + +
+ + ); +} diff --git a/client-solid/src/api.ts b/client-solid/src/api.ts index e858037..6b9660f 100644 --- a/client-solid/src/api.ts +++ b/client-solid/src/api.ts @@ -11,13 +11,12 @@ interface Votes { } export interface Post extends NewPost { - uuid: string; + id: string; createdAt: string; votes: Votes; } export async function getPosts(): Promise { -// const res = await fetch(`${API_URL}/posts`); const res = await fetch("/api/posts"); const data = await res.json(); return data; @@ -25,7 +24,9 @@ export async function getPosts(): Promise { export async function getPost(id: string): Promise { const res = await fetch(`/api/posts/${id}`); + console.log(res) const data = await res.json(); + console.log(data) return data; }