
오류 | axios interceptors(ft. react, typescript)
2022. 6. 30. 23:01
공부/오류
Object is possibly undefined ❓상황 axios에서 interceptors로 headers에 Authorization 값을 부여할때, 빨간 줄이 나오는 문제 🔎 원인 파악 config.headers는 axios request headers를 가질 수도 있고, undefined도 가질 수 있다. (property) AxiosRequestConfig.headers?: AxiosRequestHeaders | undefined 값이 undefined인 경우일때, 접근 한 경우 에러가 발생한다. How to fix config.headers.Authorization "Object is possibly undefined" when using axios interceptors I got the ..