I'm working on a registration system using vue & php, on my backend, I want error to stored and return to vue if no error, I want the vue to alert "registration successful".
I got the re-routing right but how do extract the errors from my api response,
in php i have
if(count($error)){
echo $error;
}
else {
echo json_encode(["isRegistered"=>true]);
}
in vue I have
data(){
return{
...
data : {// user data goes here},
response : ""
},
}
methods: {
...
axio.post("api/register.php" data, config)
.then((response) =>{this.response = response.data);
//the problem
console.log(this.response);
}) ;
}
In only getting Array in my console except when i change
echo $error
to
print_r($error)
in php script