Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
SSTPIERRE2 committed Mar 28, 2024
1 parent 652420f commit 042d592
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/web/components/PostGallery/PostGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,36 @@ import { PublishedPostWithTags } from '@core/post';
import PostCard from '@/components/PostCard';
import { useEffect, useState } from 'react';
import PostSkeletonGallery from '../PostSkeletonGallery';
// import useAbortController from '@/hooks/useAbortController';

interface Props {
getPosts: Function;
}

const PostGallery = ({ getPosts }: Props) => {
// const signal = useAbortController();
const [posts, setPosts] = useState<PublishedPostWithTags[]>([]);

useEffect(() => {
const getData = async () => {
// return new Promise((resolve) => {
// setTimeout(async () => {
console.log(`PostGallery getting posts...`);
const data = await getPosts();
setPosts(data);
console.log(`PostGallery got posts`, data);

if (!!data && data.length) {
setPosts(data);
}
// resolve();
// }, 5000);
// });
};

getData();
}, []);

if (posts.length) {
if (!!posts && posts.length) {
return (
<div className={styles.gallery}>
{posts.map((post) => {
Expand Down

0 comments on commit 042d592

Please sign in to comment.