I created a REST Api. From the front i send post values with axios. (i use ReactJS). In Back with Symfony, in my Controller i want to get post values. How can i do ? I did it:
from the front:
const data = new FormData();
let postData = {
source: 'lcl',
userLastname: lastname,
userFirstname: firstname,
text: message,
}
data.append('data', postData);
Axios.post('http://127.0.0.1:8000/send', data)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error)
});
And from my back in Controller i try this:
$data = $request->request->get('data');
the value return [object Object]... How can i get the value (source, userLastname etc.).
Thank you for help.