Skip to content

Commit

Permalink
Merge pull request #53 from WildCodeSchool/making-better-database
Browse files Browse the repository at this point in the history
i think i fixed it
  • Loading branch information
mahdimcheik authored Feb 25, 2024
2 parents 7a15059 + 83ae027 commit 22e5baa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
coverage
.env
public/uploads
12 changes: 3 additions & 9 deletions frontend/src/pages/PageUser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,16 @@ export default function PageUser() {
const [error, setError] = useState(false);
const [messageUpdateInfos, setMessageUpdateInfos] = useState("");

const [urlImage, setUrlImage] = useState({ preview: user.imgUrl });

async function handleChange(e) {
setUrlImage({
data: e.target.files[0],
preview: URL.createObjectURL(e.target.files[0]),
});
const formData = new FormData();
formData.append("file", e.target.files[0]);
formData.append("message", "testing");

const { imgUrl } = await axios.post(
const { data } = await axios.post(
`${import.meta.env.VITE_BACKEND_URL}/api/userimage`,
formData
);
setUser({ ...user, imgUrl });
setUser({ ...user, imgUrl: data.imgUrl });
}
async function ResetEmail() {
const res = await sendResetLink(user.email);
Expand Down Expand Up @@ -127,7 +121,7 @@ export default function PageUser() {
className="user-image"
style={{
backgroundImage: `url(${
user.imgUrl ?? urlImage.preview ?? { Default }
user.imgUrl !== "" ? user.imgUrl : Default
})`,
}}
/>
Expand Down

0 comments on commit 22e5baa

Please sign in to comment.