Skip to content

Commit

Permalink
Formatting: #291 소셜로그인 공급업체 변수명 소문자로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoonyesol committed Dec 8, 2024
1 parent 5a57d88 commit ba2ada6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/mocks/services/authServiceHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ const authServiceHandler = [
const { provider } = params as { provider: SocialLoginProvider };
const { code } = (await request.json()) as { code: string };

const validProviders = ['KAKAO', 'GOOGLE'];
const validProviders = ['kakao', 'google'];
if (!validProviders.includes(provider)) {
return HttpResponse.json({ message: '지원하지 않는 Provider입니다.' }, { status: 400 });
}

// 공급업체별 설정 정보
const providerConfigs = {
KAKAO: {
kakao: {
tokenUrl: `https://kauth.kakao.com/oauth/token`,
userInfoUrl: 'https://kapi.kakao.com/v2/user/me',
accessTokenParams: {
Expand All @@ -107,7 +107,7 @@ const authServiceHandler = [
accessTokenKey: 'access_token',
headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' },
},
GOOGLE: {
google: {
tokenUrl: `https://oauth2.googleapis.com/token`,
userInfoUrl: 'https://www.googleapis.com/userinfo/v2/me',
accessTokenParams: {
Expand Down Expand Up @@ -165,7 +165,7 @@ const authServiceHandler = [
}

// 이메일 기반으로 사용자 검색 또는 회원가입
const email = provider === 'KAKAO' ? userInfo.kakao_account.email : userInfo.email;
const email = provider === 'kakao' ? userInfo.kakao_account.email : userInfo.email;
if (!email) return HttpResponse.json({ message: '이메일 정보를 가져올 수 없습니다.' }, { status: 400 });

const foundUser = USER_DUMMY.find((user) => user.email === email);
Expand Down
4 changes: 2 additions & 2 deletions src/routes/MainRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export default function MainRouter() {
children: [
{ path: 'signup', element: <SignUpPage /> },
{ path: 'signin', element: <SignInPage /> },
{ path: 'auth/kakao/callback', element: <SocialCallBackPage provider="KAKAO" /> },
{ path: 'auth/google/callback', element: <SocialCallBackPage provider="GOOGLE" /> },
{ path: 'auth/kakao/callback', element: <SocialCallBackPage provider="kakao" /> },
{ path: 'auth/google/callback', element: <SocialCallBackPage provider="google" /> },
{ path: 'search/id', element: <SearchIdPage /> },
{ path: 'search/password', element: <SearchPasswordPage /> },
],
Expand Down
2 changes: 1 addition & 1 deletion src/types/UserType.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Role } from '@/types/RoleType';

export type SocialLoginProvider = 'KAKAO' | 'GOOGLE';
export type SocialLoginProvider = 'kakao' | 'google';

export type User = {
userId: number;
Expand Down

0 comments on commit ba2ada6

Please sign in to comment.