Skip to content

Commit

Permalink
fix: issues fixed #689
Browse files Browse the repository at this point in the history
fixed date toast error and blogs count
  • Loading branch information
jasurobo committed Dec 14, 2021
1 parent 44b55f4 commit 76818a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 3 additions & 1 deletion component/layout/BlogPost/BlogPost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export default function BlogPost(props) {

useEffect(() => {
getVoteCount();
getVoteType();
if(props.vote !== false) {
getVoteType();
}
}, []);

/**
Expand Down
15 changes: 9 additions & 6 deletions pages/p/[postId].js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ export async function getServerSideProps(context) {
// token = cookie.accessToken;

const response = await PostService.getPostById(postId);
const data = await PostService.getPostsByUsers(userId);
const { count } = data.data;
const postParams = {
status: "published",
};
const count = await PostService.getPostCount(userId, postParams);
console.log(count.data.count, 'count')
// console.log('ysggh',response);
if (!response) {
return {
Expand All @@ -45,7 +48,7 @@ export async function getServerSideProps(context) {
return {
props: {
posts: response.data,
count: count,
count: count.data.count,
// token: token,
userId: userId,
}
Expand All @@ -69,7 +72,7 @@ export async function getServerSideProps(context) {
}

export default function BlogListing(props,response) {
const { html, title, banner_image, created_by, user } = props.posts;
const { html, title, banner_image, created_at, user } = props.posts;
const count = props.count;
return (
<>
Expand All @@ -80,12 +83,12 @@ export default function BlogListing(props,response) {
<BlogSpotlight
title={title}
bannerImage={banner_image}
createdAt={created_by}
createdAt={created_at}
primaryAuthor={user}
/>
<BlogPost
userId={props.userId}
// token={props.token}
vote={false}
blog={props.posts}
html={html}
/>
Expand Down

0 comments on commit 76818a0

Please sign in to comment.