Skip to content
Snippets Groups Projects
Commit f67066fd authored by Chloé JACOB's avatar Chloé JACOB :alien:
Browse files

correction reducer + img

parent 87a333d5
Branches
Tags
No related merge requests found
......@@ -31,7 +31,6 @@ type PostProps = {
username: string;
location: string | null;
time_post: string | null;
img: Media;
caption?: string;
isLiked: boolean;
likes: number;
......@@ -43,7 +42,7 @@ type PostProps = {
const Post = ({ post, postid, username, location, time_post, img, caption, isLiked, likes, comments, comment_post, inFeed, comment_able }: PostProps) => {
const Post = ({ post, postid, username, location, time_post, caption, isLiked, likes, comments, comment_post, inFeed, comment_able }: PostProps) => {
const { t,i18n } = useTranslation();
const dispatch = useAppDispatch();
const [dropdownOpen, setDropdownOpen] = useState(false);
......@@ -58,6 +57,7 @@ const Post = ({ post, postid, username, location, time_post, img, caption, isLik
return document.execCommand('copy', true, text);
}
}
console.log(post)
return <>
{/* A POST */}
......@@ -153,7 +153,9 @@ const Post = ({ post, postid, username, location, time_post, img, caption, isLik
</div>
{/* IMAGE POST */}
<div className="flex justify-center items-center">
<img src={img.src} alt="" />
{post.resources[0] &&
<img src={post.resources[0].src} alt="" />
}
</div>
{/* BIO POST */}
<div className="p-4">
......
......@@ -2,17 +2,49 @@ import { Instalike } from '@jmetterrothan/instalike';
import { Reducer } from 'redux';
import { PostAction, SET_POST, DELETE_POST, COMMENT_POST } from './actions';
import { SetLikeFeedAction, SetUnlikeFeedAction, LIKE_POST_FEED, UNLIKE_POST_FEED, UNFOLLOW_USER_FEED, FOLLOW_USER_FEED } from '../feed/actions'
import { SetLikeFeedAction, SetUnlikeFeedAction, LIKE_POST_FEED, UNLIKE_POST_FEED, UNFOLLOW_USER_FEED, FOLLOW_USER_FEED, unfollowUserFeedAction, followUserFeedAction } from '../feed/actions'
type PostState = {
data?: Instalike.Post;
data: Instalike.Post;
};
const intialState: PostState = {
data: undefined,
data: {
id: -1,
caption: '',
accessibilityCaption: '',
location: '',
resources: [],
hasCommentsDisabled: false,
likesCount: 0,
previewLikes: [],
commentsCount: 0,
previewComments: [],
viewerHasLiked: false,
resourceType: 'Post',
createdAt: '',
owner: {
resourceType: 'User',
userName: '',
firstName: '',
lastName: '',
id: -1,
createdAt: '',
fullName: '',
avatar: '',
email: '',
biography: '',
followersCount: -1,
followingCount: -1,
postsCount: -1,
isFollowedByViewer: false,
isViewer: false,
updatedAt: '',
},
},
};
const postReducer: Reducer<PostState, PostAction | SetLikeFeedAction | SetUnlikeFeedAction > = (state = intialState, action) => {
const postReducer: Reducer<PostState, PostAction | SetLikeFeedAction | SetUnlikeFeedAction | unfollowUserFeedAction | followUserFeedAction > = (state = intialState, action) => {
switch (action.type) {
case SET_POST:
return { ...state, data: action.payload };
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment