diff --git a/packages/concordia-app/src/views/Home/HomeTopicList/index.jsx b/packages/concordia-app/src/views/Home/HomeTopicList/index.jsx index f41bb2f..e70c759 100644 --- a/packages/concordia-app/src/views/Home/HomeTopicList/index.jsx +++ b/packages/concordia-app/src/views/Home/HomeTopicList/index.jsx @@ -41,7 +41,7 @@ const HomeTopicList = () => { useEffect(() => { if (numTopicsResult) { - setNumTopics(parseInt(numTopicsResult.value, 10)); + setNumTopics(parseInt(numTopicsResult.value, 10) || 0); } }, [numTopicsResult]); diff --git a/packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx b/packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx index 51dbf37..3436aea 100644 --- a/packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx +++ b/packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx @@ -51,13 +51,15 @@ const ProfilePostList = (props) => { useEffect(() => { if (getUserPostCountResult) { - setUserPostCount(parseInt(getUserPostCountResult.value, 10)); + setUserPostCount(parseInt(getUserPostCountResult.value, 10) || 0); } }, [getUserPostCountResult, userPostCount]); useEffect(() => { if (getUserPostsResult) { - setPostIds(getUserPostsResult.value.slice().reverse().map(Number)); + const { value } = getUserPostsResult; + const res = value || []; + setPostIds(res.slice().reverse().map(Number)); } }, [getUserPostsResult, userPostCount]); diff --git a/packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx b/packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx index 0450cc5..c51aa51 100644 --- a/packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx +++ b/packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx @@ -51,13 +51,15 @@ const ProfileTopicList = (props) => { useEffect(() => { if (getUserTopicCountResult) { - setUserTopicCount(parseInt(getUserTopicCountResult.value, 10)); + setUserTopicCount(parseInt(getUserTopicCountResult.value, 10) || 0); } }, [getUserTopicCountResult, userTopicCount]); useEffect(() => { if (getUserTopicsResult) { - setTopicIds(getUserTopicsResult.value.slice().reverse().map(Number)); + const { value } = getUserTopicsResult; + const res = value || []; + setTopicIds(res.slice().reverse().map(Number)); } }, [getUserTopicsResult, userTopicCount]); diff --git a/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx b/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx index 7d26870..c83e3c4 100644 --- a/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx +++ b/packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx @@ -49,13 +49,15 @@ const TopicPostList = (props) => { useEffect(() => { if (getTopicPostCountResult) { - setTopicPostCount(parseInt(getTopicPostCountResult.value, 10)); + setTopicPostCount(parseInt(getTopicPostCountResult.value, 10) || 0); } }, [getTopicPostCountResult, topicPostCount]); useEffect(() => { if (getTopicPostsResult) { - setPostIds(getTopicPostsResult.value.slice().map(Number)); + const { value } = getTopicPostsResult; + const res = value || []; + setPostIds(res.slice().map(Number)); } }, [getTopicPostsResult, topicPostCount]);