clean up post check
This commit is contained in:
parent
3ac9cbcf4e
commit
e646df43f2
1 changed files with 4 additions and 4 deletions
|
@ -25,17 +25,17 @@ const Post = ({renderedPost, theme, changeTheme}: PostProps) => {
|
|||
async function fetchPost() {
|
||||
setIsLoading(true);
|
||||
|
||||
if (renderedPost.ok) {
|
||||
if (renderedPost) {
|
||||
setPost(renderedPost)
|
||||
setIsLoading(false)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (renderedPost.status.toString().startsWith("4")) {
|
||||
router.push("/signin")
|
||||
if (!Cookies.get('drift-token')) {
|
||||
router.push('/signin');
|
||||
} else {
|
||||
setError(renderedPost.statusText)
|
||||
setError('Post Error');
|
||||
}
|
||||
}
|
||||
fetchPost()
|
||||
|
|
Loading…
Reference in a new issue