nagasurendra commited on
Commit
d68a0f1
·
verified ·
1 Parent(s): 6fa5b25

Update templates/loyalty.html

Browse files
Files changed (1) hide show
  1. 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"></div>
 
 
13
 
14
  <script>
15
- fetch('/loyalty')
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
- alert(data.message || 'Error loading loyalty data');
36
  }
37
  })
38
- .catch(error => console.error('Error:', 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>