From ac9027c522d4ac3f23a9bf69a51148cda3ac5c08 Mon Sep 17 00:00:00 2001 From: Anton <62949848+icepaq@users.noreply.github.com> Date: Wed, 16 Mar 2022 18:57:40 -0400 Subject: [PATCH] fix wrong post check --- client/pages/post/[id].tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/pages/post/[id].tsx b/client/pages/post/[id].tsx index f3a2da33..2e5d69ad 100644 --- a/client/pages/post/[id].tsx +++ b/client/pages/post/[id].tsx @@ -25,17 +25,17 @@ const Post = ({renderedPost, theme, changeTheme}: PostProps) => { async function fetchPost() { setIsLoading(true); - if (renderedPost) { + if (renderedPost.ok) { setPost(renderedPost) setIsLoading(false) return; } - if (post.status.toString().startsWith("4")) { + if (renderedPost.status.toString().startsWith("4")) { router.push("/signin") } else { - setError(post.statusText) + setError(renderedPost.statusText) } } fetchPost()