I have the following code in a react-redux
powered application. The code is split across a couple of files but I've just combined it below for simplicity:
const token = localStorage.getItem('token');
const authClient = axios.create({
baseURL: "http://api.empaygo.local",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
const getUser = async (userId) => {
const result = await authClient.get(`/users/${userId}`);
return result;
}
const user = users.getUser(1);
console.log(user);
The final console log is always:
And I cannot work out how to get the data that I need out of it. Any help would great :)