[e14] axios instance: CORS error

김고야·2023년 9월 25일

React.js

목록 보기
15/23
post-thumbnail

1. BE에서 CORS 세팅과 로컬 혹은 프론트 엔드포인트의 도메인 지정이 되어있는지 확인.
2. 모르면 복사해서 붙여 넣자.

import axios from "axios";

const instance = axios.create({
  baseURL: "https://jaeha0183.com",
  headers: {
    "Content-Type": "application/json",
  },
  withCredentials: true,
  mode: "cors",
});

export default instance;
profile
Frontend Engineer

0개의 댓글