diff --git a/backend/public/assets/usersAvatars/0e808374bd2993ca162a4e3e2bb703cf-The_Phantom_Troupe_Logo.jpg.webp b/backend/public/assets/usersAvatars/0e808374bd2993ca162a4e3e2bb703cf-The_Phantom_Troupe_Logo.jpg.webp deleted file mode 100644 index 559b357..0000000 Binary files a/backend/public/assets/usersAvatars/0e808374bd2993ca162a4e3e2bb703cf-The_Phantom_Troupe_Logo.jpg.webp and /dev/null differ diff --git a/backend/public/assets/usersAvatars/1e8152b03fdb1be16ee2fab2fa87a769-tatouage-brigade-fantome-hunter-x-hunter-316169.webp b/backend/public/assets/usersAvatars/1e8152b03fdb1be16ee2fab2fa87a769-tatouage-brigade-fantome-hunter-x-hunter-316169.webp deleted file mode 100644 index c5073c8..0000000 Binary files a/backend/public/assets/usersAvatars/1e8152b03fdb1be16ee2fab2fa87a769-tatouage-brigade-fantome-hunter-x-hunter-316169.webp and /dev/null differ diff --git a/backend/public/assets/usersAvatars/7bad873a2b308da51803041b3fbfc1d5-The_Phantom_Troupe_Logo.jpg.webp b/backend/public/assets/usersAvatars/7bad873a2b308da51803041b3fbfc1d5-The_Phantom_Troupe_Logo.jpg.webp deleted file mode 100644 index 559b357..0000000 Binary files a/backend/public/assets/usersAvatars/7bad873a2b308da51803041b3fbfc1d5-The_Phantom_Troupe_Logo.jpg.webp and /dev/null differ diff --git a/frontend/src/pages/Profil.jsx b/frontend/src/pages/Profil.jsx index c8262d0..7a25cb1 100644 --- a/frontend/src/pages/Profil.jsx +++ b/frontend/src/pages/Profil.jsx @@ -3,7 +3,7 @@ import axios from "axios"; import Recipe from "./Recipe"; import "./style/RecipeList.scss"; - +import addimage from "../assets/addimage.svg"; import "./style/Profil.scss"; function Profil() { @@ -11,15 +11,12 @@ function Profil() { const [editing, setEditing] = useState(false); const [recipeBy, setRecipeBy] = useState([]); const [userData, setUserData] = useState({ - avatar: null, username: null, firstname: null, lastname: null, birthdate: null, description: null, }); - const [selectedFile, setSelectedFile] = useState(null); - const [selectedFileUrl, setselectedFileUrl] = useState(null); const [fav, setFav] = useState([]); const handleEditClick = () => { @@ -76,27 +73,23 @@ function Profil() { } }, [id]); - const handleSaveClick = async () => { - try { - const formData = new FormData(); - formData.append("avatar", selectedFile); - formData.append("name", userData.recipeName); - formData.append("title", userData.recipeDesc); - formData.append("prep_time", userData.prepTime); - formData.append("nb_people", userData.nbPeople); - formData.append("difficulty", userData.difficulty); - - await axios - .put(`${import.meta.env.VITE_BACKEND_URL}/api/users/${id}`, formData, { - withCredentials: true, - }) - .then(() => { - setEditing(false); - }); - setEditing(false); - } catch (err) { - console.error(err); - } + const handleSaveClick = () => { + axios + .put( + `${import.meta.env.VITE_BACKEND_URL}/api/users/${id}`, + { + username: userData.username, + description: userData.description, + firstname: userData.firstname, + lastname: userData.lastname, + birthdate: userData.birthdate, + }, + { withCredentials: true } + ) + .then(() => { + setEditing(false); + }); + setEditing(false); }; const handleChange = (e) => { @@ -106,33 +99,13 @@ function Profil() { [name]: value, })); }; - const handleFileInput = (e) => { - setSelectedFile(e.target.files[0]); - }; - const handleImageUpload = (e) => { - if (e.target.files && e.target.files[0]) { - const imgFile = e.target.files[0]; - setselectedFileUrl(URL.createObjectURL(imgFile)); - } - }; - - const combineImagehandler = (e) => { - handleFileInput(e); - handleImageUpload(e); - }; - const imageUrl = `${import.meta.env.VITE_BACKEND_URL}/${userData.avatar}`; return (
- - {selectedFileUrl ? ( - Preview - ) : ( - vide || "photo de profil" - )} + No Photos