From bed195770e7af07ea66b58c1c8eb7691affa84a3 Mon Sep 17 00:00:00 2001 From: Martin Quarda Date: Sun, 13 Oct 2024 09:49:28 +0200 Subject: [PATCH] fix --- alkatorapi/views.py | 3 ++- frontend/src/scripts/index.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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}) })