const handleSubmit = async(e) => {
const url ='https://3a66-103-59-74-38.in.ngrok.io'
const path='api/v1/purchase-order/save'
const data = {
billTo:billTo,
shipTo:shipTo,
supplyPlace:supplyPlace,
pan:pan,
gstin:gstIn,
billNo: "",
billDate:billDate.toString(),
items:inputList
}
const res = await fetch(`${url}/${path}`, {
method: 'POST',
//made :'cors',
headers: {
'Content-Type': 'application/json;charset=utf-8',
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Headers':origin,
'Access-Control-Allow-Credentials':true
},
body: JSON.stringify(data),
})
This is the code that I have written in react to make a POST request to the backend written in Java . But ,My POSTMAN request gives 200 whereas it is coming 403 on backend . Also ,the method that shows there is not POST .It is 'OPTIONS' that shows at the backend console .