Hello I created an ionic project and I am posting values via ajax to laravel backend (laravell is hosted by MAMP on the background), Whenever I am trying it by postman it's working correctly with a code 200
But whenever I am trying it with my ionic project the code is here
function submitAxiosFormPost(e: React.FormEvent<HTMLInputElement>) {
//? e: React.FormEvent<HTMLInputElement>
// e.preventDefault();
axios.post('http://localhost:8888/api/register', {
name: username,
email: email,
password: password,
password_confirmation: passwordConfirm
})
.then(function (response) {
console.log(response);
window.localStorage.setItem('profile', JSON.stringify(response.data.user));
window.localStorage.setItem('token', JSON.stringify(response.data.access_token));
})
.catch(function (error) {
console.log(error);
// console.log("ERRRR:: ", error.response.data);
});
// name:Nairi7,
// email:hnairiareg7@gmail.com,
// password:Nairi7,
// password_confirmation:Nairi7,
console.log(`Username: ${username}\nEmail: ${email}\nPassword: ${password}\nPasswordConfirm: ${passwordConfirm}`);
}
it's bringing this error

