Skip to content

Commit

Permalink
FE-15 🔥 api 함수 불필요한 부분 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
newjinlee committed Jul 23, 2024
1 parent b27c881 commit 96520ce
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/apis/getTodayEpigram.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
import { EpigramType } from '@/schema/todayepigram';
import { AxiosError } from 'axios';
import type { EpigramType } from '@/schema/todayepigram';
import httpClient from './index';

const getTodayEpigram = async (): Promise<EpigramType> => {
try {
const response = await httpClient.get<EpigramType>('/epigrams/today');
return response.data;
} catch (error) {
if (error instanceof AxiosError) {
if (error.response) {
throw new Error('에피그램 조회 요청 처리 중 문제가 발생했습니다.');
} else if (error.request) {
throw new Error('서버 응답을 받지 못했습니다. 잠시 후 다시 시도해 주세요.');
} else {
throw new Error('에피그램 조회 요청을 처리하는 동안 문제가 발생했습니다.');
}
} else {
throw new Error('알 수 없는 오류가 발생했습니다.');
}
}
const response = await httpClient.get('/epigrams/today');
return response.data;
};

export default getTodayEpigram;

0 comments on commit 96520ce

Please sign in to comment.