I faced a problem in my mern app. how to fix it. thank
src\utils\setAuthToken.js
Line 5:35: ["Authorization"] is better written in dot notation dot-notation
Line 7:42: ["Authorization"] is better written in dot notation dot-notation
Search for the keywords to learn more about each error.
import axios from 'axios';
const setAuthToken = (token) => {
if (token) {
axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
} else {
delete axios.defaults.headers.common['Authorization'];
}
};
export default setAuthToken;