Skip to content

Commit 521687e

Browse files
authored
fix: 회원가입시 재로그인(임시) (#42)
1 parent 777345a commit 521687e

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/hooks/queries/login/useGetGoogleToken.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const useGetGoogleToken = (code: string | null = '') => {
1212

1313
if (data?.data?.accessToken === undefined) {
1414
void router.push(`/mypage/profile?googleEmail=${data?.data?.googleEmail}`);
15+
return;
1516
}
1617
if (data?.data) {
1718
localStorage.setItem('accessToken', data.data.accessToken);

src/hooks/queries/login/usePostUser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const usePostUser = () => {
2222
}) => {
2323
localStorage.setItem('accessToken', data.accessToken);
2424
localStorage.setItem('refreshToken', data.refreshToken);
25-
void router.push('/home');
25+
void router.push('/login');
2626
};
2727
return useBaseMutation<PostUserBodyType>(queryKeys.KAKAO(), `/users`, onSuccess);
2828
};

src/pages/login/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import MonstersImg from '@/assets/images/img_login_monsters.svg';
22
import KaKaoImg from '@/assets/images/img_login_kakao.svg';
3-
import GoogleImg from '@/assets/images/img_login_google.svg';
3+
// import GoogleImg from '@/assets/images/img_login_google.svg';
44
import LogoTextImg from '@/assets/logos/text_logo_l.svg';
55
import { type NextPage } from 'next';
66
import { useGetGoogleToken, useGetKakaoToken } from '@/hooks/queries/login';
@@ -10,15 +10,15 @@ const LoginPage: NextPage = () => {
1010
const router = useRouter();
1111

1212
const kakaoURL = `https://kauth.kakao.com/oauth/authorize?client_id=${process.env.NEXT_PUBLIC_KAKAO_API_KEY}&redirect_uri=${process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI}&response_type=code`;
13-
const googleURL = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${process.env.NEXT_PUBLIC_GOOGLE_API_KEY}&redirect_uri=${process.env.NEXT_PUBLIC_GOOGLE_REDIRECT_URI}&response_type=code&scope=email&access_type=offline`;
13+
// const googleURL = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${process.env.NEXT_PUBLIC_GOOGLE_API_KEY}&redirect_uri=${process.env.NEXT_PUBLIC_GOOGLE_REDIRECT_URI}&response_type=code&scope=email&access_type=offline`;
1414

1515
const handleKaKaoClick: () => void = () => {
1616
window.location.href = `${kakaoURL}&type=kakao`;
1717
};
1818

19-
const handleGoogleClick: () => void = () => {
20-
window.location.href = `${googleURL}&type=google`;
21-
};
19+
// const handleGoogleClick: () => void = () => {
20+
// window.location.href = `${googleURL}&type=google`;
21+
// };
2222

2323
const { code, scope } = router.query;
2424

@@ -43,7 +43,7 @@ const LoginPage: NextPage = () => {
4343
<div className="flex-1 w-[96px] h-[1px] bg-gray6"></div>
4444
</div>
4545
<div className="flex gap-[20px]">
46-
<GoogleImg onClick={handleGoogleClick} />
46+
{/* <GoogleImg onClick={handleGoogleClick} /> */}
4747
<KaKaoImg onClick={handleKaKaoClick} />
4848
</div>
4949
</div>

src/pages/mypage/profile/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const ProfilePage: NextPage = () => {
3737

3838
const MyInfo = kakaoId ? null : useGetMe();
3939

40-
const [selectedProfile, setSelectedProfile] = useState<ProfileEnum>('GREEN');
40+
const [selectedProfile, setSelectedProfile] = useState<ProfileEnum>(MyInfo?.profileImage ?? 'GREEN');
4141
const [nickname, setNickname] = useState(MyInfo?.nickname ?? '');
4242
const [isNicknameAvailable, setIsNicknameAvailable] = useState<null | boolean>(null);
4343
const [isNicknameChecked, setIsNicknameChecked] = useState<null | boolean>(null);

0 commit comments

Comments
 (0)