Skip to content

Commit

Permalink
fix: 동적인 데이터 캐시하지 않도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
gyeongza committed Jun 14, 2024
1 parent e65ff5f commit e82bbd4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/features/product/api/getProductList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const getProductListUrl = (category: string) => `${API_BASE_URL}/api/v1/p

export const getProductList = async (category: CategoryType): Promise<GetProductListResponse> => {
try {
const response = await fetch(getProductListUrl(category));
const response = await fetch(getProductListUrl(category), { cache: 'no-store' });

const data: GetProductListResponse = (await response.json()) as GetProductListResponse;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CategoryType } from '@/features/category/constants';

export const ProductDetail = async ({ productId, category }: { productId: number; category: CategoryType }) => {
try {
const response = await fetch(`${API_BASE_URL}/api/v1/products/${category}/${productId}`);
const response = await fetch(`${API_BASE_URL}/api/v1/products/${category}/${productId}`, { cache: 'no-store' });
if (!response.ok) {
throw new Error(`서버에서 데이터를 가져오는 데 실패했습니다. 상태 코드: ${response.status}`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/search/api/getSearchResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getSearchResult = async (

const url = `${getSearchResultUrl(category)}?${queryParams}&${pageParams}`;

const response = await fetch(url);
const response = await fetch(url, { cache: 'no-store' });

const data = (await response.json()) as GetSearchResultResponse;

Expand Down

0 comments on commit e82bbd4

Please sign in to comment.