I use codeigniter4 for backend and vue3 for frontend. In displaying the image in vue3 this issue appears:
Response was blocked by CORB (Cross-Origin Read Blocking)
Cross-Origin Read Blocking (CORB) blocked a cross-origin response.
Please help me to solve that problem.
This are my code:
(codeigniter)
public function show($id = null)
{
$model = new Product();
$data = $model->find($id);
if ($data) {
$data['product_photo'] = base_url('uploads/' . $data['product_photo']);
$data['supplier_names'] = $this->getSupplierNamesForProduct($id);
return $this->respond($data);
}
return $this->failNotFound('Product not found');
}
(vue)
<script>
import axios from 'axios';
export default {
name: 'ProductOverview',
data() {
return {
productId: this.$route.params.id,
product: {
product_photo: '',
// other product properties
}
};
},
mounted() {
this.getData();
},
methods: {
getData() {
axios.get(`http://localhost:8080/products/${this.productId}`)
.then(res => {
this.product = res.data;
})
.catch(error => {
console.error("There was an error fetching the product data:", error);
});
}
}
};
</script>
I expect the CORB issue to be solve.
New contributor
Russel Dodon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.