I have localhost FastApi as a backend. It has only post method that write into db some data. I a new at vue. I have tested post method with python
data = {
"page_id": "v1",
"useragent": "Mozilla/5.0",
"ip_adress": "1.1.1.1",
"age": 31,
"question": 1,
"answer_array": str([1,2,3]),
"other_answer": ""
}
requests.post('http://127.0.0.1:8000/events/v1/items', json=data)
FastApi said me that it is ok.
INFO: 127.0.0.1:33472 - "POST /events/v1/items/ HTTP/1.1" 200 OK
The same thing I tried to do at web page. I have code
axios.post('http://127.0.0.1:8000/events/v1/items', JSON.stringify({
"page_id": "v1",
"useragent": "Mozilla/5.0",
"ip_adress": "1.1.1.1",
"age": 31,
"question": 1,
"answer_array": toString([1,2,3]),
"other_answer": ""
}) )
.then(function (response) { console.log(response) } )
.catch(function (error) { console.log(error) } )
But in that case my Fast Api said that is wrong
INFO: 127.0.0.1:48180 - "POST /events/v1/items HTTP/1.1" 307 Temporary Redirect
I tried add JSON.stringify in idea that it doesn't serialized well Can you please help me/ What I doing wrong in vue code?