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

try add data user connected in profile page

parent 65e6426e
No related merge requests found
......@@ -80,4 +80,13 @@ export const fetchProfileAsync = (): AppThunkAction<Promise<void>> => {
const { data } = await api.users.me.posts.fetch({ cursor: null, amount: 20 });
dispatch(setUserFeed(data.items));
}
};
\ No newline at end of file
};
// Data user connected
// export const fetchProfileDataAsync = (): AppThunkAction<Promise<void>> => {
// return async (dispatch, getState, api) => {
// const { data } = await api.users.me.fetch();
// console.log(data.id);
// dispatch(setUserFeed(data.items));
// }
// };
......@@ -13,7 +13,7 @@ import DiscoverPost from '../components/DiscoverPost';
// AUTRES FICHIERS
import useAppDispatch from '../hooks/useAppDispatch';
import useFeedItems from '../hooks/useFeedItems';
import { fetchProfileAsync } from '../redux/feed/thunks';
import { fetchProfileAsync, fetchProfileDataAsync } from '../redux/feed/thunks';
// ICONS
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
......@@ -32,6 +32,11 @@ const Profile = () => {
const feedItems = useFeedItems();
// console.log("Before calling fetchProfileDataAsync");
//dispatch(fetchProfileDataAsync());
// console.log("After calling fetchProfileDataAsync");
return <>
{/* HEADER */}
......@@ -95,10 +100,10 @@ return <>
<div className="max-w-[995px] mx-auto mt-8 mb-16 px-4 flex flex-col items-center">
{/* A DISCOVER POST */}
{feedItems && feedItems.length > 0 ? (
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-5">
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3">
{feedItems &&
feedItems.map((post: Instalike.Post) => {
console.log(post)
// console.log(post)
return (
<Link key={post.id} to={`/post/${post.id}`} className="flex justify-center">
......
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