diff --git a/frontend/components/Product.vue b/frontend/components/Product.vue index 02c3193..7a54ff1 100644 --- a/frontend/components/Product.vue +++ b/frontend/components/Product.vue @@ -66,7 +66,11 @@ export default { const productSlug = this.$route.params.slug - fetch(`http://localhost:30010/api/product/${ productSlug }`) + let url = `/api/products/${ productSlug }`; + if (window.location.href.includes('localhost')) + url = 'http://localhost:30010'.concat(url) + + fetch(url) .then(resp => resp.json()) .then(product => this.product = product); },