diff --git a/client/src/pages/EditProfilePage/EditProfilePage.tsx b/client/src/pages/EditProfilePage/EditProfilePage.tsx index 0257e26..3a07c94 100644 --- a/client/src/pages/EditProfilePage/EditProfilePage.tsx +++ b/client/src/pages/EditProfilePage/EditProfilePage.tsx @@ -1,4 +1,10 @@ -import React, { useEffect, useState, ChangeEvent, FormEvent } from "react"; +import React, { + useEffect, + useState, + useRef, + ChangeEvent, + FormEvent, +} from "react"; import { useAppSelector, useAppDispatch } from "../../app/hooks"; import { fetchUserProfile, @@ -10,6 +16,7 @@ const EditProfilePage = () => { const dispatch = useAppDispatch(); const { profile, status } = useAppSelector((state) => state.userProfile); const userID = useAppSelector((state) => state.user.userData?._id); + const fileInputRef = useRef(null); const [formData, setFormData] = useState({ fullName: "", @@ -68,6 +75,10 @@ const EditProfilePage = () => { dispatch(uploadProfilePicture({ formData, userID })); }; + const handleFileInputClick = () => { + fileInputRef.current?.click(); + }; + if (status === "loading" || !userID) { return
Loading...
; } @@ -120,7 +131,7 @@ const EditProfilePage = () => { />