From 79208cb9c2467c7a6198eca554eabce1b14a2054 Mon Sep 17 00:00:00 2001 From: Hollgy Date: Fri, 8 Mar 2024 10:04:35 +0100 Subject: [PATCH] conditional rendering of new comment added, typo corrected --- client-solid/src/Components/NewPost.tsx | 2 +- client-solid/src/Components/SinglePost.tsx | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client-solid/src/Components/NewPost.tsx b/client-solid/src/Components/NewPost.tsx index 0dbdbc2..0726537 100644 --- a/client-solid/src/Components/NewPost.tsx +++ b/client-solid/src/Components/NewPost.tsx @@ -8,7 +8,7 @@ export function NewPostInputArea(): JSXElement { const [content, setContent] = createSignal(""); const [waiting, setWaiting] = createSignal(false); - // We assumte this context is always available + // We assume this context is always available const login_ctx = useContext(LoginContext)!; const nav = useNavigate(); diff --git a/client-solid/src/Components/SinglePost.tsx b/client-solid/src/Components/SinglePost.tsx index 65c41dd..2dfd919 100644 --- a/client-solid/src/Components/SinglePost.tsx +++ b/client-solid/src/Components/SinglePost.tsx @@ -1,6 +1,6 @@ import { useParams } from "@solidjs/router"; -import { JSXElement, Show, Suspense, createResource } from "solid-js"; - +import { JSXElement, Show, Suspense, createResource, useContext } from "solid-js"; +import { LoginContext } from "../Context/GlobalState"; import { loadSpinner } from "../Util/Icons"; import { getPost } from "../Util/api"; import { CommentSection } from "./CommentSection"; @@ -10,12 +10,15 @@ import { NewCommentInputArea } from "./NewComment"; export function SinglePost(): JSXElement { const params = useParams(); const [post] = createResource(params.postid, getPost); + const login_ctx = useContext(LoginContext)!; // Assuming login context is always available return ( - + + +