diff --git a/alkatorapi/views.py b/alkatorapi/views.py index 48ed837..8cd12a0 100644 --- a/alkatorapi/views.py +++ b/alkatorapi/views.py @@ -180,7 +180,7 @@ def login_status(request): "last_name": user.profile.last_name, "address": user.profile.address, "racers": [{ - "invoice_id": racer.invoice.invoice_id, + "invoice_id": racer.invoice_id, "first_name": racer.first_name, "last_name": racer.last_name, "email": racer.email, @@ -331,6 +331,7 @@ def payment_state(request): def products(request): return HttpResponse(json.dumps([ { + 'id': product.id, 'name': product.name, 'description': product.description, 'img': product.img.url, diff --git a/frontend/src/scripts/index.js b/frontend/src/scripts/index.js index aebb360..4407f7f 100644 --- a/frontend/src/scripts/index.js +++ b/frontend/src/scripts/index.js @@ -25,6 +25,7 @@ class Main extends Component { gallery_open: undefined, page: window.location.hash, photos: [], + products: [], photoIsOpen: false, progress: false, currentImage: 0, @@ -37,6 +38,9 @@ class Main extends Component { fetch(addr_prefix + "/api/photos").then(resp => resp.json()).then(json => { this.setState({photos: json}) }) + fetch(addr_prefix + "/api/products").then(resp => resp.json()).then(json => { + this.setState({products: json}) + }) fetch(addr_prefix + "/api/login_status").then(resp => resp.json()).then(json => { this.setState({login_status: json}) })