Skip to content

Commit

Permalink
Merge pull request #56 from Chaem03/feature/#22
Browse files Browse the repository at this point in the history
🔥 Fix: 에러페이지 연동 오류 수정
  • Loading branch information
Chaem03 authored Sep 15, 2024
2 parents 03c1f73 + 357339a commit 884315f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/apis/instance.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import axios from "axios";
import Cookies from "js-cookie";
const accessToken = Cookies.get("access_token");

export const instance = axios.create({
baseURL: import.meta.env.VITE_BASE_URL,
withCredentials: true,
Expand Down Expand Up @@ -30,7 +29,7 @@ instance.interceptors.request.use(
instance.interceptors.response.use(
(response) => response,
(error) => {
if (error.response) {
if (error.response && error.response.status !== 200) {
if (error.response.status === 404) {
console.log("404 error: Page not found");
window.location.href = "/error";
Expand All @@ -41,6 +40,9 @@ instance.interceptors.response.use(
"USER_LOCATION_002: 사용자와 명소 정보가 일치하지 않습니다."
);
window.location.href = "/error";
} else {
console.log("Unknown error occurred");
window.location.href = "/error";
}
} else if (error.code === "ECONNABORTED") {
console.log("Request timeout");
Expand Down

0 comments on commit 884315f

Please sign in to comment.