diff --git a/client/src/Components/EditAccount/EditAccount.jsx b/client/src/Components/EditAccount/EditAccount.jsx index 8ca67423..db0ed1d3 100644 --- a/client/src/Components/EditAccount/EditAccount.jsx +++ b/client/src/Components/EditAccount/EditAccount.jsx @@ -8,12 +8,11 @@ import ModalToggler from "../Modals/ModalToggler.jsx"; import RegisterUserForm from "./RegisterUserForm.jsx"; import usePublicUserStore from "../../store/user/public-user.store.js"; import CloudinaryImageService from "../../service/asset/image.service.js"; -import "./EditAccount.css"; const EditAccount = () => { - const publicUserStore = usePublicUserStore() + const publicUserStore = usePublicUserStore(); const userData = JSON.parse(localStorage.getItem("userData")); - const entity = publicUserStore.getEntity() + const entity = publicUserStore.getEntity(); const [editProfile, setEditProfileActive] = useState(false); const [newProfile, setNewProfile] = useState({ userid: entity.userid ? entity.userid : "", @@ -58,199 +57,185 @@ const EditAccount = () => { const handleImageChange = async (e) => { const file = e.target.files[0]; let url; - if (!file) - return + if (!file) return; - const loadingToast = toast.loading('Saving image...'); + const loadingToast = toast.loading("Saving image..."); try { - const response = await CloudinaryImageService.uploadImage(file) - url = response.data.url + const response = await CloudinaryImageService.uploadImage(file); + url = response.data.url; } catch (err) { toast.dismiss(loadingToast); - console.log(err) - return + console.log(err); + return; } if (url) { - const publicUser = publicUserStore.getEntity() - await publicUserStore.updatePublicUser({ ...publicUser, profile_picture: url }) + const publicUser = publicUserStore.getEntity(); + await publicUserStore.updatePublicUser({ + ...publicUser, + profile_picture: url, + }); } toast.dismiss(loadingToast); - toast.success("Profile picture updated successfully", { autoClose: 500 }) + toast.success("Profile picture updated successfully", { autoClose: 500 }); }; - const handleSubmit = async (e) => { e.preventDefault(); const status = await publicUserStore.updatePublicUser(newProfile); if (status) { - toast.success("Account updated successfully", { autoClose: 500 }) + toast.success("Account updated successfully", { autoClose: 500 }); } }; return ( -