Changed api calls to check for localhost.

This commit is contained in:
2020-07-19 16:12:16 +02:00
parent df18245f0d
commit 9d2cd9e9f9
2 changed files with 10 additions and 2 deletions

View File

@@ -29,6 +29,10 @@ export default {
}
},
created() {
let url = '/api/products'
if (window.location.href.includes('localhost'))
url = 'http://localhost:30010'.concat(url)
fetch('http://localhost:30010/api/products')
.then(resp => resp.json())
.then(products => this.products = products)