|
|
|
@ -25,17 +25,17 @@ const Post = ({renderedPost, theme, changeTheme}: PostProps) => {
|
|
|
|
async function fetchPost() {
|
|
|
|
async function fetchPost() {
|
|
|
|
setIsLoading(true);
|
|
|
|
setIsLoading(true);
|
|
|
|
|
|
|
|
|
|
|
|
if (renderedPost) {
|
|
|
|
if (renderedPost.ok) {
|
|
|
|
setPost(renderedPost)
|
|
|
|
setPost(renderedPost)
|
|
|
|
setIsLoading(false)
|
|
|
|
setIsLoading(false)
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (post.status.toString().startsWith("4")) {
|
|
|
|
if (renderedPost.status.toString().startsWith("4")) {
|
|
|
|
router.push("/signin")
|
|
|
|
router.push("/signin")
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setError(post.statusText)
|
|
|
|
setError(renderedPost.statusText)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fetchPost()
|
|
|
|
fetchPost()
|
|
|
|
|