parent
5de0542907
commit
4bf2a9250e
@ -0,0 +1,37 @@
|
||||
import React, {useEffect,useState} from 'react';
|
||||
import {useDispatch, useSelector} from "react-redux";
|
||||
import {getPosts} from "../actions/post.actions";
|
||||
import {getUserTemp} from "../actions/user.actions";
|
||||
import {useParams} from "react-router-dom";
|
||||
import {isEmpty} from "./Utils";
|
||||
import FollowHandler from "./UserProfil/FollowHandler";
|
||||
|
||||
const MiniProfil = ({uid} ) => {
|
||||
const [userData, setUserData] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
const response = await fetch(`${process.env.REACT_APP_API_URL}api/user/${uid}`);
|
||||
const data = await response.json();
|
||||
setUserData(data);
|
||||
}
|
||||
fetchData();
|
||||
}, [uid]);
|
||||
|
||||
if (!userData) {
|
||||
return <p>Loading...</p>;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className="ListReco">
|
||||
<div className="UtiReco">
|
||||
<img className="image" src={userData.picture}/>
|
||||
<a href={`/Profil/${uid}`}>{userData.pseudo}</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MiniProfil;
|
@ -1,80 +1,36 @@
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import React, {useState} from 'react';
|
||||
import Navbar from '../components/Navbar';
|
||||
import Notif from '../components/Notif';
|
||||
import {useDispatch, useSelector} from "react-redux";
|
||||
import {getNotif, getUser} from '../actions/user.actions';
|
||||
import {isEmpty} from "../components/Utils";
|
||||
import axios from "axios";
|
||||
import FollowHandler from "../components/UserProfil/FollowHandler";
|
||||
import Post from "../components/Post/Post";
|
||||
import {useSelector} from "react-redux";
|
||||
|
||||
|
||||
const Trends = () => {
|
||||
console.log('test');
|
||||
const [loadNotif, setLoadNotif] = useState(true);
|
||||
const [count , setCount] = useState(5);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [setLoadNotif] = useState(true);
|
||||
const userData = useSelector((state) => state.user.user);
|
||||
const usersData = useSelector((state) => state.users.users);
|
||||
|
||||
const loadMore = () => {
|
||||
if (window.innerHeight + document.documentElement.scrollTop + 1 > document.scrollingElement.scrollHeight){
|
||||
setLoadNotif(true);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("userData",userData,userData.notif, userData.notif.length);
|
||||
console.log("idUser: ",userData._id);
|
||||
|
||||
return (
|
||||
<div id={'listeNotif'}>
|
||||
<Navbar />
|
||||
<h1>Notification</h1>
|
||||
{ /*userData.notif.length ? userData.notif.filter(notif => notif._id === userData.notif._id).map((notif) => <Notif message="dfdf"/>)
|
||||
: <h3>Aucune Notification</h3>*/
|
||||
|
||||
{
|
||||
userData.notif != null && userData.notif.map((notif) => {
|
||||
return <Notif notification={notif}/>
|
||||
return (
|
||||
<li>
|
||||
<Notif key={notif._id} notification={notif}/>
|
||||
</li>
|
||||
);
|
||||
})
|
||||
|
||||
}
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
return (
|
||||
<div id={'listeNotif'}>
|
||||
<Navbar />
|
||||
<h1>Notification</h1>
|
||||
{
|
||||
return(<h3>Aucune Notification</h3>);
|
||||
userData.notif.map((notif) => {
|
||||
for (let i = 0; i < userData.notif.length; i++) {
|
||||
if (notif._id === userData.notif[i]) {
|
||||
return (
|
||||
<Notif message="dfdf"/>
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
return <h3>Aucune Notification</h3>;
|
||||
})
|
||||
}
|
||||
</div>
|
||||
);*/
|
||||
|
||||
return (
|
||||
<div id={'listeNotif'}>
|
||||
<Navbar />
|
||||
<h1>Notification</h1>
|
||||
<Notif message="a like"/>
|
||||
<Notif message="a like"/>
|
||||
<Notif message="a like"/>
|
||||
<Notif message="a like"/>
|
||||
<Notif message="a like"/>
|
||||
<Notif message="a commenter votre poste"/>
|
||||
</div>);
|
||||
};
|
||||
|
||||
export default Trends;
|
Loading…
Reference in new issue