Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Todis-UMC/Todis_web into…
Browse files Browse the repository at this point in the history
… feat-#58
  • Loading branch information
4928vibe committed Aug 22, 2023
2 parents 51916cc + f3979d6 commit bd81a8e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 15 deletions.
10 changes: 10 additions & 0 deletions src/component/layout/Nav/SideMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ const SideMenu: React.FC<SideMenuProps> = ({ onClose }) => {
<div style={FONT.H7}>{route.text}</div>
</MenuLink>
))}
{token && (
<MenuLink
onClick={() => {
navigate('/user/edit');
onClose();
}}
>
<div style={FONT.H7}>회원정보 수정</div>
</MenuLink>
)}
</div>
</Menu>
<Background
Expand Down
3 changes: 2 additions & 1 deletion src/component/login/SocialGoogle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import FONT from '../../styles/Font';
import { ReactComponent as Google } from '../../assets/icon/Google.svg';
const SocialGoogle = () => {
const Client_id = process.env.REACT_APP_GOOGLE_CLIENT_ID;
const rediect_url = 'http://localhost:3000/google';
const rediect_url =
'http://todis.s3-website.ap-northeast-2.amazonaws.com/google';
const googleURL = `https://accounts.google.com/o/oauth2/auth?client_id=${Client_id}&redirect_uri=${rediect_url}&response_type=code&scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile`;

const googleSocialLogin = async () => {
Expand Down
3 changes: 2 additions & 1 deletion src/component/login/SocialKakao.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import FONT from '../../styles/Font';

const SocialKakao = () => {
const Rest_api_key = process.env.REACT_APP_KAKAO_REST_API_KEY;
const redirect_uri = 'http://localhost:3000/kakao';
const redirect_uri =
'http://todis.s3-website.ap-northeast-2.amazonaws.com/kakao';

const kakaoURL = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${Rest_api_key}&redirect_uri=${redirect_uri}`;

Expand Down
36 changes: 23 additions & 13 deletions src/component/mypage/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const ItemMenu = [
Images('./E2_hat.png'),
Images('./E3_sunglasses.png'),
Images('./E4_watch.png'),
Images('./E5_W.png'),
Images('./E5_M.png'),
Images('./E6_umbrella.png')
],
buttonImages: [
Expand Down Expand Up @@ -157,7 +157,7 @@ const Avatar = () => {
setInventory(updatedInventory);
setSelectedImages(updatedSelectedImages);

console.log('현재 착용된: ', updatedSelectedImages);
// console.log('현재 착용된: ', updatedSelectedImages);

// 아이템 이미지 URL 배열
const selectedImageArray: (string | '')[] = ItemMenu.map((menu, index) => {
Expand Down Expand Up @@ -197,11 +197,7 @@ const Avatar = () => {

const updatedImages = [...ItemMenu];
// 성별에 따라 소품 '안경' 이미지 변경
if (selected) {
updatedImages[3].images[4] = E5_W_Image;
} else {
updatedImages[3].images[4] = E5_M_Image;
}
updatedImages[3].images[4] = selected ? E5_M_Image : E5_W_Image;
// 아이템도 초기화
setSelectedImages([]);
setInventory([]);
Expand All @@ -210,9 +206,15 @@ const Avatar = () => {
const ResetHandler = () => {
setSelectedImages([]);
setInventory([]);
setSelectedImagesinit([]);
setInventoryinit([]);
};

const SaveHandler = async () => {
if (saving) {
return; // 이미 저장 중인 경우 중복 요청 막음
}

// 아이템 변경 없이 저장하기 클릭 시
setSaveButtonText('저장 완료!');

Expand All @@ -237,9 +239,9 @@ const Avatar = () => {
const avatarImgFormData = new FormData();
const blob = await fetch(avatarSaveImg).then((r) => r.blob()); // 이미지 데이터를 Blob으로 변환
avatarImgFormData.append('file', blob, 'file');
avatarImgFormData.forEach((value, key) => {
/* avatarImgFormData.forEach((value, key) => {
console.log(key, value);
});
}); */
try {
const response = await axios.post(
`${baseURL}/cody/all`,
Expand Down Expand Up @@ -345,7 +347,6 @@ const Avatar = () => {
console.log('image Response Data:', response.data);
} catch (error) {
console.error('Error:', error);
console.log('/cody/image 오류');
}
}
}
Expand All @@ -361,14 +362,19 @@ const Avatar = () => {
});

const responseData = response.data;
console.log('GET 아바타 데이터:', responseData);
// console.log('GET 아바타 데이터:', responseData);

const gender = responseData.data.gender;
setAvatarImg(
gender === true ? Images('./W_Avatar.png') : Images('./M_Avatar.png')
);
setSelected(gender === true ? true : false);
console.log('GET 성별:', gender);
const E5_W_Image = Images('./E5_W.png');
const E5_M_Image = Images('./E5_M.png');
const updatedImages = [...ItemMenu];
// 성별에 따라 소품 '안경' 이미지 변경
updatedImages[3].images[4] = gender ? E5_W_Image : E5_M_Image;
// console.log('GET 성별:', gender);

if (responseData) {
setSelectedImagesinit([
Expand Down Expand Up @@ -491,7 +497,11 @@ const Avatar = () => {
/>
))}
</ImageButtonsContainer>
<SaveBtn onClick={SaveHandler} saving={saving}>
<SaveBtn
onClick={SaveHandler}
saving={saving}
style={{ pointerEvents: saving ? 'none' : 'auto' }}
>
<div style={isMobile ? FONT.H5 : FONT.H4}>{saveButtonText}</div>
</SaveBtn>
</ItemBox>
Expand Down

0 comments on commit bd81a8e

Please sign in to comment.