fix wrong post check
This commit is contained in:
parent
7364eb668b
commit
ac9027c522
1 changed files with 3 additions and 3 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue