solved using
try {
const response = await axios.post(${HOST}/login
, null, {
params: {
usr: username,
pwd: password,
},
});
if (response.data.message === ‘Logged In’) {
localStorage.setItem(‘token’, response.data.message);
toast.success(‘Logged In Successfully’);
navigate(‘/dashboard’);
} else {
toast.error(‘Login Failed’);
}
} catch (error) {
toast.error(‘An error occurred during login’);
}