diff --git a/project2-front/src/page/ProfilePage.jsx b/project2-front/src/page/ProfilePage.jsx index e2913fc..23ce815 100644 --- a/project2-front/src/page/ProfilePage.jsx +++ b/project2-front/src/page/ProfilePage.jsx @@ -14,6 +14,7 @@ import { FollowerListProvider } from "../component/Followers/Context/FollowerLis import {usePost} from "../component/Post/Context/UsePost.jsx"; import NoPostHereComponent from "../component/UserProfile/NoPostHereComponent.jsx"; import {HorizontalRule} from "@mui/icons-material"; +import {useAuth} from "../util/auth/UseAuth.jsx"; const ProfilePage = () => { const location = useLocation(); @@ -21,6 +22,7 @@ const ProfilePage = () => { const { username } = useParams(); const [key, setKey] = useState(0); const { listPostData } = usePost(); + const { isAuthenticated } = useAuth(); const getUser = async (user) => { try { @@ -32,6 +34,14 @@ const ProfilePage = () => { } }; + const handleButtonDisplay = () => { + if (isAuthenticated) { + return setKey(key + 1)} user={userData} /> + } else { + return
+ } +} + useEffect(() => { if (location.state?.userObj) { setUserData(location.state?.userObj); @@ -65,7 +75,7 @@ const ProfilePage = () => { }} > {userData && ( - setKey(key + 1)} user={userData} /> + handleButtonDisplay() )} {userData && (