Skip to content

Commit

Permalink
Merge pull request #57 from prgrms-web-devcourse-final-project/featur…
Browse files Browse the repository at this point in the history
…e/login

feat: 프로필 이미지 (#13)
  • Loading branch information
OpenS3same authored Dec 11, 2024
2 parents 6be3e7a + 3d10ce4 commit 0f5598d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/pages/myPage/SettingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const SettingPage = () => {
<GS.Content>
<ProfileWrapper>
<img
src={'/images/profile.png'}
src={profileImage || '/images/origin.png'}
alt="Profile"
width={80}
height={80}
Expand Down
7 changes: 6 additions & 1 deletion src/components/pages/myPage/SideMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getUser } from '../../../api/mypageApi';
const Sidemenu = () => {
const navigate = useNavigate();
const location = useLocation();
const [profileImage, setProfileImage] = useState<string | null>(null);
const [newName, setNewName] = useState('');

const isActive = (path: string) => location.pathname === path;
Expand All @@ -15,6 +16,7 @@ const Sidemenu = () => {
try {
const response = await getUser();

setProfileImage(response.profile);
setNewName(response.name);
} catch (error) {
console.error('failed', error);
Expand All @@ -26,7 +28,10 @@ const Sidemenu = () => {
return (
<Wrapper>
<ProfileSection>
<ProfileImage src={'/images/profile.png'} alt="Profile" />
<ProfileImage
src={profileImage || '/images/origin.png'}
alt="Profile"
/>
<ProfileText>
<Hello>Hello 👋</Hello>
<Username>{newName}</Username>
Expand Down

0 comments on commit 0f5598d

Please sign in to comment.