Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE] Fix/myinfo 마이페이지 닉네임 변경 시 이미지 사라지던 오류 수정 #515

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions frontend/src/components/MyInfo/UpdateMyInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ProfileProps } from '../../types/Profile';
import Button from '../common/Button';
import Text from '../common/Text';
import usePatch from '../../apiHooks/usePatch';
import useToast from '../../hooks/useToast';

interface UpdateMyInfoProps {
myInfo: ProfileProps;
Expand All @@ -19,6 +20,7 @@ const UpdateMyInfo = ({
setMyInfo,
}: UpdateMyInfoProps) => {
const { fetchPatch } = usePatch();
const { showToast } = useToast();

const onChangeMyInfoName = (e: React.ChangeEvent<HTMLInputElement>) => {
if (e.target.value.length >= 20) return;
Expand All @@ -32,10 +34,10 @@ const UpdateMyInfo = ({
nickName: myInfo.nickName,
},
errorMessage: '회원정보 수정에 실패했습니다.',
isThrow: true,
onSuccess: () => {
localStorage.setItem('user', JSON.stringify(myInfo));
setIsModifyMyInfo(false);
showToast('info', '회원정보를 수정했습니다.');
},
});
};
Expand All @@ -48,7 +50,7 @@ const UpdateMyInfo = ({
$justifyContent="center"
$alignItems="center"
>
<MyInfoImg src={myInfo.image} />
<MyInfoImg src={myInfo.imageUrl} />
<Space size={5} />
<Box>
<MyInfoInput value={myInfo.nickName} onChange={onChangeMyInfoName} />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/MyInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const MyInfo = () => {
const [myInfo, setMyInfo] = useState<ProfileProps>({
nickName: user.nickName,
email: user.email,
image: user.imageUrl,
imageUrl: user.imageUrl,
});

const onClickSetting = () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export const LAYOUT_PADDING = '40px';
export const DEFAULT_TOPIC_IMAGE =
'https://velog.velcdn.com/images/semnil5202/post/37f3bcb9-0b07-4100-85f6-f1d5ad037c14/image.svg';

export const DEFAULT_PROD_URL = 'https://mapbefine.kro.kr/api';
export const DEFAULT_PROD_URL = 'https://mapbefine.com/api';
1 change: 0 additions & 1 deletion frontend/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const TopicListContainer = lazy(
);

const Home = () => {
console.log(`${process.env.APP_URL}`, '환경변수 테스트');
const { routingHandlers } = useNavigator();
const { goToPopularTopics, goToLatestTopics, goToNearByMeTopics } =
routingHandlers;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types/Profile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface ProfileProps {
nickName: string;
email: string;
image: string;
imageUrl: string;
}