Newer
Older
import { Instalike } from '@jmetterrothan/instalike';
import UserStory from '../components/UserStory';
import Post from '../components/Post';
// AUTRES FICHIERS
import useAppDispatch from '../hooks/useAppDispatch';
import useFeedItems from '../hooks/useFeedItems';
import { fetchFeedUserAsync, calculateTime } from '../redux/feed/thunks';
const dispatch = useAppDispatch();
dispatch(fetchFeedUserAsync());
}, []);
const feedItems = useFeedItems();
{/* FEED */}
<div className="max-w-[640px] mx-auto mt-8 mb-16 px-4">
{feedItems &&
feedItems.map((post: Instalike.Post) => {
console.log(post)
const time_post = calculateTime(post.createdAt);
return (
<Post key={post.id}
username={post.owner.userName}
location={post.location}
time_post={time_post}
img={post.resources[0]}
caption={post.caption}
isLiked={post.viewerHasLiked}
likes={post.likesCount}
comments={post.commentsCount}
comment_post={post.previewComments}
></Post>
);
})}