Skip to content

Commit

Permalink
fix: 덜컥임 수정, 필드 추가 (#143)
Browse files Browse the repository at this point in the history
* fix: 401 에러 관련 수정 (#140)

* fix: 드롭다운 색상 수정

* fix: 인증 관련 오류 수정

* fix: 글로벌 에러바운더리 추가

* chore: 주석 코드 리버트

* fix: 덜컥임 수정, 필드 추가 (#142)

* fix: StrictMode 제거 및 불필요한 의존성 제거

* fix: 덜컥임 없도록 수정

* feat: ShowSalesTicketResponse 하위 필드 추가
  • Loading branch information
alstn2468 authored Aug 4, 2024
1 parent 24e602d commit 600d8a3
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const ShowNameWrapper = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
height: 80px;
`;

const ShowName = styled.h2<ShowNameProps>`
Expand Down
7 changes: 1 addition & 6 deletions apps/admin/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom/client';

import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
68 changes: 35 additions & 33 deletions apps/admin/src/pages/OAuth/OAuthKakaoPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useKakaoLogin, useKakaoToken, useKakaoUserInfo, useSignUp } from '@boolti/api';
import { useCallback, useEffect, useMemo } from 'react';
import { useCallback, useEffect } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { useAuthAtom } from '~/atoms/useAuthAtom';

Expand All @@ -10,45 +10,46 @@ const OAuthKakaoPage = () => {
const location = useLocation();
const navigate = useNavigate();

const code = useMemo(() => new URLSearchParams(location.search).get('code'), [location.search]);

const kakaoTokenMutation = useKakaoToken();
const kakaoUserInfoMutation = useKakaoUserInfo();
const kakaoLoginMutation = useKakaoLogin();
const signUpMutation = useSignUp();

const kakaoSignUp = useCallback(
async ({ kakaoAccessToken }: { kakaoAccessToken: string }) => {
const userInfo = await kakaoUserInfoMutation.mutateAsync({
accessToken: kakaoAccessToken,
secureResource: true,
propertyKeys: [
'kakao_account.profile',
'kakao_account.name',
'kakao_account.email',
'kakao_account.age_range',
'kakao_account.birthday',
'kakao_account.gender',
],
});
const kakaoSignUp = useCallback(async ({ kakaoAccessToken }: { kakaoAccessToken: string }) => {
const userInfo = await kakaoUserInfoMutation.mutateAsync({
accessToken: kakaoAccessToken,
secureResource: true,
propertyKeys: [
'kakao_account.profile',
'kakao_account.name',
'kakao_account.email',
'kakao_account.age_range',
'kakao_account.birthday',
'kakao_account.gender',
],
});

const { accessToken, refreshToken } = await signUpMutation.mutateAsync({
nickname: userInfo.kakao_account?.profile?.nickname,
email: userInfo.kakao_account?.email,
phoneNumber: userInfo.kakao_account?.phone_number,
oauthType: 'KAKAO',
oauthIdentity: `${userInfo.id}`,
imgPath: userInfo.kakao_account?.profile?.profile_image_url,
});
const { accessToken, refreshToken } = await signUpMutation.mutateAsync({
nickname: userInfo.kakao_account?.profile?.nickname,
email: userInfo.kakao_account?.email,
phoneNumber: userInfo.kakao_account?.phone_number,
oauthType: 'KAKAO',
oauthIdentity: `${userInfo.id}`,
imgPath: userInfo.kakao_account?.profile?.profile_image_url,
});

setToken(accessToken, refreshToken);
navigate(PATH.SIGNUP_COMPLETE, { replace: true });
},
[kakaoUserInfoMutation, navigate, signUpMutation, setToken],
);
setToken(accessToken, refreshToken);
navigate(PATH.SIGNUP_COMPLETE, { replace: true });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const kakaoLogin = useCallback(async () => {
if (!code) return;
const code = new URLSearchParams(location.search).get('code');

if (!code) {
navigate(PATH.HOME, { replace: true });
return;
}

const { access_token: kakaoAccessToken } = await kakaoTokenMutation.mutateAsync({ code });
const { accessToken, refreshToken, signUpRequired } = await kakaoLoginMutation.mutateAsync({
Expand All @@ -62,8 +63,9 @@ const OAuthKakaoPage = () => {
}

setToken(accessToken, refreshToken);
navigate(PATH.HOME);
}, [code, kakaoLoginMutation, kakaoSignUp, kakaoTokenMutation, navigate, setToken]);
navigate(PATH.HOME, { replace: true });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
kakaoLogin();
Expand Down
19 changes: 17 additions & 2 deletions apps/preview/src/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
@import url("https://cdnjs.cloudflare.com/ajax/libs/pretendard/1.3.9/static/pretendard-dynamic-subset.min.css");
@import url('https://cdnjs.cloudflare.com/ajax/libs/pretendard/1.3.9/static/pretendard-dynamic-subset.min.css');

* {
font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
font-family:
'Pretendard Variable',
Pretendard,
-apple-system,
BlinkMacSystemFont,
system-ui,
Roboto,
'Helvetica Neue',
'Segoe UI',
'Apple SD Gothic Neo',
'Noto Sans KR',
'Malgun Gothic',
'Apple Color Emoji',
'Segoe UI Emoji',
'Segoe UI Symbol',
sans-serif;
}
7 changes: 1 addition & 6 deletions apps/preview/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom/client';

import App from './App.tsx';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
7 changes: 1 addition & 6 deletions apps/super-admin/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom/client';

import App from './App.tsx';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
7 changes: 7 additions & 0 deletions packages/api/src/types/show.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,18 @@ export interface ReservationSummaryResponse {
}

export type ShowSalesTicketResponse = {
/** 판매 티켓 ID */
id: number;
/** 티켓 이름 */
ticketName: string;
/** 티켓 가격(장당) */
price: number;
/** 남은 티켓 수량. 재고 */
quantity: number;
/** 총 티켓 수량 */
totalForSale: number;
/** 최소 한번 이상 판매된 티켓이 있는지 여부 */
soldAtLeastOnce: boolean;
}[];

export type ShowInvitationTicketResponse = {
Expand Down

0 comments on commit 600d8a3

Please sign in to comment.