Custom route for product details when localhost.

This commit is contained in:
2020-07-21 13:15:00 +02:00
parent cc7308cdfa
commit f6c8e1fdf6

View File

@@ -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);
},