-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: 회원 가입 시 프로필 이미지를 기본 이미지로 설정하는 기능 추가 * feat: 프로필 수정 시 프로필 이미지를 기본 이미지로 설정하는 기능 추가 * refactor: profile image url이 null 일 경우 기본 이미지를 보여주도록 변경 * refactor: 프로필 기본 이미지 변경 로직 보완 및 커스텀 훅 분리 * refactor: profileImageUrlRequest 파생 상태 제거
- Loading branch information
1 parent
b8e2954
commit 9d5bd71
Showing
9 changed files
with
87 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useState } from 'react'; | ||
import useConfirm from '../../../hooks/useConfirm'; | ||
|
||
interface Props { | ||
currentProfileImage: string | null; | ||
defaultProfileImage: string; | ||
} | ||
|
||
const useDefaultProfileImage = ({ currentProfileImage, defaultProfileImage }: Props) => { | ||
const openConfirm = useConfirm(); | ||
const [profileImageUrl, setProfileImageUrl] = useState<string>(currentProfileImage || defaultProfileImage); | ||
|
||
const onClickSetDefaultProfileImage = async () => { | ||
const isDeleteProfileImage = await openConfirm({ | ||
content: '기본 프로필 이미지로 변경하시겠습니까?', | ||
}); | ||
|
||
if (isDeleteProfileImage) setProfileImageUrl(defaultProfileImage); | ||
}; | ||
|
||
return { profileImageUrl, onClickSetDefaultProfileImage }; | ||
}; | ||
|
||
export default useDefaultProfileImage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters