Spaces:
Runtime error
Runtime error
Update templates/loyalty.html
Browse files- templates/loyalty.html +9 -4
templates/loyalty.html
CHANGED
@@ -9,10 +9,12 @@
|
|
9 |
</head>
|
10 |
<body>
|
11 |
<h1>Your Loyalty Status</h1>
|
12 |
-
<div id="loyalty-info"
|
|
|
|
|
13 |
|
14 |
<script>
|
15 |
-
fetch('
|
16 |
.then(response => response.json())
|
17 |
.then(data => {
|
18 |
if (data.success) {
|
@@ -32,10 +34,13 @@
|
|
32 |
`;
|
33 |
document.getElementById('loyalty-info').innerHTML = html;
|
34 |
} else {
|
35 |
-
|
36 |
}
|
37 |
})
|
38 |
-
.catch(error =>
|
|
|
|
|
|
|
39 |
</script>
|
40 |
</body>
|
41 |
</html>
|
|
|
9 |
</head>
|
10 |
<body>
|
11 |
<h1>Your Loyalty Status</h1>
|
12 |
+
<div id="loyalty-info">
|
13 |
+
<p>Loading loyalty data...</p>
|
14 |
+
</div>
|
15 |
|
16 |
<script>
|
17 |
+
fetch('{{ url_for("cart.checkout.loyalty") }}') // Use the correct endpoint name
|
18 |
.then(response => response.json())
|
19 |
.then(data => {
|
20 |
if (data.success) {
|
|
|
34 |
`;
|
35 |
document.getElementById('loyalty-info').innerHTML = html;
|
36 |
} else {
|
37 |
+
document.getElementById('loyalty-info').innerHTML = `<p>${data.message || 'Error loading loyalty data'}</p>`;
|
38 |
}
|
39 |
})
|
40 |
+
.catch(error => {
|
41 |
+
console.error('Error:', error);
|
42 |
+
document.getElementById('loyalty-info').innerHTML = '<p>Failed to load loyalty data</p>';
|
43 |
+
});
|
44 |
</script>
|
45 |
</body>
|
46 |
</html>
|