aboutsummaryrefslogtreecommitdiff
path: root/src/containers/Profile
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers/Profile')
-rw-r--r--src/containers/Profile/ProfileInfo.tsx16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/containers/Profile/ProfileInfo.tsx b/src/containers/Profile/ProfileInfo.tsx
index 4c9f17e..777a779 100644
--- a/src/containers/Profile/ProfileInfo.tsx
+++ b/src/containers/Profile/ProfileInfo.tsx
@@ -112,21 +112,23 @@ const ProfileInfo: React.FC<PropTypes> = ({
const dateSince = useMemo(() => formatDate(userInfo?.createdAt), [userInfo]);
const handleUpdateAvatar = useCallback(async (file: File) => {
- if (user) uploadFileToS3(file, 0.8, setProgress)
- .then(avatarUrl => patch(`/users/${user._id}`, { avatarUrl }))
- .then(response => setUserInfo(response.data))
- .then(() => setProgress(0));
+ if (user) {
+ uploadFileToS3(file, 0.8, setProgress)
+ .then(avatarUrl => patch(`/users/${user._id}`, { avatarUrl }))
+ .then(response => setUserInfo(response.data))
+ .then(() => setProgress(0));
+ }
}, [user, setUserInfo]);
- const handleCropAvatar = useCallback( async(file: File) => {
+ const handleCropAvatar = useCallback(async (file: File) => {
const imageSrc = URL.createObjectURL(file);
setAvatarToCrop(imageSrc);
- },[]);
+ }, []);
return (
<div className={classes.root}>
{
- avatarToCrop && <AvatarCropModal avatar={avatarToCrop} callback={handleUpdateAvatar}/>
+ avatarToCrop && <AvatarCropModal avatar={avatarToCrop} callback={handleUpdateAvatar} />
}
{
!userInfo