I have an issue with React when I try to retrieve the value of return.
The code:
export const RuoloOnline = (jwt) => {
axios.get("http://localhost:1337/api/users/me",
{
headers: {
"Authorization": `Bearer ${jwt}`
}
}
).then((res) => { return (res.data.ruolo) }).catch(() => {return 0})
if I put a console.log the value is correctly viewed. If I try to call this function outside the file, it generates an undefined return.