I am creating react and laraval project and I want to use 3d models (.glb type image). I upload .glb type image and after that, I want to display it in my dashboard. I do it using map function as shown in below.
ViewProducts.js
viewProductTable = productlist.map((item) =>{
return (
<tr key={item.id}>
<td>{item.id}</td>
<td>{item.category.name}</td>
<td>{item.name}</td>
<td>{item.selling_price}</td>
<td><model-viewer src={`http://localhost:8000/${item.pimage}`} width="60px" auto-rotate camera-controls></model-viewer></td>
<td><Link to={`products/${item.id}`} className="btn btn-success btn-sm">Edit</Link></td>
<td><button type="button" onClick={(e) => deleteProduct(e, item.id)} className="btn btn-danger btn-sm">Delete</button></td>
</tr>
)
});
Error:
Access to XMLHttpRequest at 'http://localhost:8000/uploads/products/1640341595.glb' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
How fix this error?