Skip to content

Commit

Permalink
chore : interceptor ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloWook committed Nov 6, 2024
1 parent 13e3aa3 commit 3bf621b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/shared/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ const baseUrl = process.env.REACT_APP_API_URL as string;

const defaultApi = (option?: AxiosRequestConfig): AxiosInstance => {
const instance = axios.create({ baseURL: baseUrl, ...option });

instance.interceptors.response.use(
(response) => response,
(error) => {
if (process.env.NODE_ENV !== 'production') {
console.error('API Error:', error);
}
return Promise.reject(error);
}
);
return instance;
};

Expand Down

0 comments on commit 3bf621b

Please sign in to comment.