Skip to content

Commit

Permalink
fix: add cookie in ResultCategoryDetail request
Browse files Browse the repository at this point in the history
  • Loading branch information
yougyung committed Apr 27, 2024
1 parent 5a78e22 commit 2d519a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/(sub-page)/result/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function ResultPage({ searchParams }: ResultPageProp) {
<ResultCategoryCard key={index} />
))}
</div>
<ResultCategoryDetail category={category} />
{category && <ResultCategoryDetail category={category} />}
</div>
);
}
Expand Down
7 changes: 6 additions & 1 deletion app/business/result/result.query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LectureInfo } from '@/app/type/lecture';
import { API_PATH } from '../api-path';
import { cookies } from 'next/headers';
import { httpErrorHandler } from '@/app/utils/http/http-error-handler';

export interface ResultCategoryDetailLectures {
Expand Down Expand Up @@ -30,7 +31,11 @@ export interface ResultUserInfo {
export const fetchResultCategoryDetailInfo = async (category: string): Promise<ResultCategoryDetailInfo> => {
//FIX : category를 querystring으로 호출하는 건은 mock단계에서는 불필요할 것으로 예상, 실제 api 연결시 변경 예정
try {
const response = await fetch(API_PATH.resultCategoryDetailInfo);
const response = await fetch(`${API_PATH.resultCategoryDetailInfo}`, {
headers: {
Authorization: `Bearer ${cookies().get('accessToken')?.value}`,
},
});
const result = await response.json();

httpErrorHandler(response, result);
Expand Down

0 comments on commit 2d519a5

Please sign in to comment.