-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix : (blocked:mixed-content) 해결 * fix : use http * Revert "fix : default url" This reverts commit 806d0e0. * fix : api default url * feat : 주문내역 및 포인트 api 연결 * docs : 질문 답변
- Loading branch information
1 parent
656c314
commit 21a6348
Showing
20 changed files
with
272 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,33 @@ | ||
# react-deploy | ||
# react-deploy | ||
|
||
### 질문 1. SPA 페이지를 정적 배포를 하려고 할 때 Vercel을 사용하지 않고 한다면 어떻게 할 수 있을까요? | ||
|
||
- `npm run build`를 통해 빌드된 파일을 정적 호스팅 서비스에 업로드하면 됩니다. | ||
- AWS S3, Github Pages 등을 사용할 수 있습니다. | ||
- 빌드된 파일을 서버에 올리는 방법은 다음과 같습니다. | ||
- AWS S3: S3 버킷을 생성하고 빌드된 파일을 업로드합니다. | ||
- Github Pages: Github 저장소에 빌드된 파일을 업로드합니다. | ||
|
||
### 질문 2. CSRF나 XSS 공격을 막는 방법은 무엇일까요? | ||
|
||
- CSRF(Cross-Site Request Forgery) 공격을 막는 방법 | ||
|
||
- CSRF 토큰을 사용합니다. | ||
- SameSite 쿠키 속성을 사용합니다. | ||
- Referer 검증을 사용합니다. | ||
- 사용자의 동작을 요구하는 방식을 사용합니다. | ||
|
||
- XSS(Cross-Site Scripting) 공격을 막는 방법 | ||
- 사용자 입력값을 필터링합니다. | ||
- 사용자 입력값을 필터링하여 스크립트를 실행할 수 없도록 합니다. | ||
- 사용자 입력값을 HTML 엔티티로 변환하여 스크립트를 실행할 수 없도록 합니다. | ||
- 사용자 입력값을 JavaScript Escape하여 스크립트를 실행할 수 없도록 합니다. | ||
|
||
### 질문 3. 브라우저 렌더링 원리에대해 설명해주세요. | ||
|
||
- 브라우저 렌더링 원리 | ||
- HTML 문서를 파싱하여 DOM 트리를 생성합니다. | ||
- CSS 스타일을 파싱하여 CSSOM 트리를 생성합니다. | ||
- DOM 트리와 CSSOM 트리를 결합하여 렌더 트리를 생성합니다. | ||
- 렌더 트리를 기반으로 레이아웃을 계산합니다. | ||
- 레이아웃을 기반으로 픽셀을 그리고 화면에 표시합니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { UseQueryResult } from '@tanstack/react-query'; | ||
|
||
import { useAxiosQuery } from '@/api'; | ||
import type { GetOrderPriceResponseBody } from '@/api/type'; | ||
type RequestParams = { | ||
optionId: string; | ||
quantity: number; | ||
productId: string; | ||
}; | ||
|
||
export function getOrderPricePath({ optionId, quantity, productId }: RequestParams): string { | ||
return `/api/orders/price?optionId=${optionId}&quantity=${quantity}&productId=${productId}`; | ||
} | ||
|
||
function useGetOrderPrice({ | ||
optionId, | ||
quantity, | ||
productId, | ||
}: RequestParams): UseQueryResult<GetOrderPriceResponseBody> { | ||
return useAxiosQuery<GetOrderPriceResponseBody>( | ||
{ | ||
method: 'GET', | ||
url: getOrderPricePath({ optionId, quantity, productId }), | ||
}, | ||
['orderPrice', optionId, quantity.toString(), productId], | ||
); | ||
} | ||
|
||
export default useGetOrderPrice; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { UseAxiosQueryWithPageResult } from '@/api'; | ||
import { useAxiosQueryWithPage } from '@/api'; | ||
import { sessionStorageApiWithAuth } from '@/api/axiosInstance'; | ||
import type { GetOrdersResponseBody } from '@/api/type'; | ||
import { authSessionStorage } from '@/utils/storage'; | ||
|
||
type RequestParams = { | ||
size?: number; | ||
page?: number; | ||
sort?: string; | ||
}; | ||
|
||
export function getOrdersPath({ size, sort }: RequestParams): string { | ||
return `/api/orders?size=${size}&sort=${sort}`; | ||
} | ||
|
||
function useGetOrders({ | ||
size = 20, | ||
sort = 'id,desc', | ||
}: RequestParams): UseAxiosQueryWithPageResult<GetOrdersResponseBody> { | ||
const token = authSessionStorage.get()?.token ?? ''; | ||
|
||
return useAxiosQueryWithPage<GetOrdersResponseBody>( | ||
{ | ||
method: 'GET', | ||
url: getOrdersPath({ size, sort }), | ||
}, | ||
['orders'], | ||
(lastPage) => (!lastPage.last ? (lastPage.number + 1).toString() : undefined), | ||
sessionStorageApiWithAuth(token), | ||
); | ||
} | ||
|
||
export default useGetOrders; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { UseQueryResult } from '@tanstack/react-query'; | ||
|
||
import { useAxiosQuery } from '@/api'; | ||
import { sessionStorageApiWithAuth } from '@/api/axiosInstance'; | ||
import type { GetPointResponseBody } from '@/api/type'; | ||
import { authSessionStorage } from '@/utils/storage'; | ||
|
||
export function getPointPath(): string { | ||
return '/api/members/point'; | ||
} | ||
|
||
function useGetPoint(): UseQueryResult<GetPointResponseBody> { | ||
const token = authSessionStorage.get()?.token ?? ''; | ||
|
||
return useAxiosQuery<GetPointResponseBody>( | ||
{ | ||
method: 'GET', | ||
url: getPointPath(), | ||
}, | ||
['point'], | ||
{}, | ||
sessionStorageApiWithAuth(token), | ||
); | ||
} | ||
|
||
export default useGetPoint; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { UseAxiosMutationResult } from '@/api'; | ||
import { useAxiosMutation } from '@/api'; | ||
import { sessionStorageApiWithAuth } from '@/api/axiosInstance'; | ||
import type { PostOrderRequestBody } from '@/api/type'; | ||
import { authSessionStorage } from '@/utils/storage'; | ||
|
||
export function postOrderPath(): string { | ||
return '/api/orders'; | ||
} | ||
|
||
function usePostOrder(): UseAxiosMutationResult<void, PostOrderRequestBody> { | ||
const token = authSessionStorage.get()?.token ?? ''; | ||
|
||
return useAxiosMutation<void, PostOrderRequestBody>( | ||
{ | ||
method: 'POST', | ||
url: postOrderPath(), | ||
}, | ||
sessionStorageApiWithAuth(token), | ||
); | ||
} | ||
|
||
export default usePostOrder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.