Skip to content

Commit

Permalink
fix: pagination and blog listing #585
Browse files Browse the repository at this point in the history
fixed blog listing and pagination issue
  • Loading branch information
jasurobo committed Dec 1, 2021
1 parent f6da1ab commit 28bd6ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions component/myblogs/WriteNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,13 @@ export default function WriteNav({
className={`h-24 min-h-24 border border-dashed border-gray-400 rounded overflow-hidden relative ${!currentPost.bannerImage && "cursor-pointer"
}`}
>
{currentPost.bannerImage ? (
{currentPost.banner_image ? (
<div className="w-full h-full flex justify-center items-center overflow-hidden relative hoverPreview">
{loading ? (
<div>Loading...</div>
) : (
<img
src={currentPost.bannerImage}
src={currentPost.banner_image}
alt="banner"
width="100%"
/>
Expand Down
7 changes: 6 additions & 1 deletion pages/admin/blogs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ const Admin = () => {
...pagination,
page,
limit,
sort_field: 'updated_at',
order: 'DESC',
skip: page == 1 ? 0 : (page - 1) * 10
};
setPagination(data);
Expand All @@ -158,6 +160,8 @@ const Admin = () => {
const data = {
...pagination,
tag: tag,
sort_field: 'updated_at',
order: 'DESC',
page: 1,
status: status
// skip: 0
Expand All @@ -183,7 +187,8 @@ const Admin = () => {
* @author athulraj2002
*/
const filterStatusPosts = (status) => {
const data = { ...pagination, status: status, page: 1 };
const data = { ...pagination, status: status, page: 1, sort_field: 'updated_at',
order: 'DESC', };
setPagination((previousState) => {
return { ...previousState, status: status, page: 1 };
});
Expand Down

0 comments on commit 28bd6ea

Please sign in to comment.