diff options
author | ilyayudovin <46264063+ilyayudovin@users.noreply.github.com> | 2020-11-17 15:51:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 15:51:37 +0300 |
commit | bd9a1b7f4222788c784c2c14366e5181da520cf9 (patch) | |
tree | 5227a935584dbbdf68f8be8278a3fdeb7b300734 /src/containers/Profile/ProfileInfo.tsx | |
parent | db731f1b88fdfa95f16255767e44762211f47196 (diff) | |
parent | fe82b4e0ef835e6921575f1927174479bea7f777 (diff) | |
download | which-ui-bd9a1b7f4222788c784c2c14366e5181da520cf9.tar.gz |
Merge pull request #109 from which-ecosystem/avatarCrop
fix: clear eslint errors
Diffstat (limited to 'src/containers/Profile/ProfileInfo.tsx')
-rw-r--r-- | src/containers/Profile/ProfileInfo.tsx | 16 |
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 |