Good day to all! Using axios, I send a GET request to the API with the existing token, but this response is returned: how to fix? at the moment, the application consists of the created directory using create-react-app ... I send the request in the componentDidMount method:
componentDidMount() { const instance = axios.create({ method: 'get', withCredentials: true, responseType: 'json', responseEncoding: 'utf8', }); axios.defaults.baseURL = 'https://domen/api/organization'; axios.defaults.headers.common['Authorization'] = 'MY_TOKEN'; axios.defaults.headers.post['Content-Type'] = 'application/json'; instance() .then(res => { console.log(res); }) .catch(err => { console.log(err); });
}