axios returns data in the data object, go with:
const loginHandler = (e) => {
e.preventDefault();
try {
axios.post('http://localhost:5000/api/auth/login',
{
email,
password
}
).then(res => localStorage.setItem("refreshToken", res.data.refreshToken))
} catch (err) {
console.log(err)
}
}