hamza82 commited on
Commit
0884f51
·
verified ·
1 Parent(s): 4116dc5

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +17 -11
static/index.html CHANGED
@@ -2,19 +2,25 @@
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
- <title>Static Content</title>
6
- </head>
7
- <body>
8
- <h1>Welcome to the Static Page</h1>
9
- <button onclick="fetchApi()">Call API</button>
10
- <p id="apiResponse"></p>
11
  <script>
12
- function fetchApi() {
13
- fetch('/api')
14
- .then(response => response.json())
15
- .then(data => document.getElementById('apiResponse').innerText = data.message)
16
- .catch(error => console.error('Error:', error));
 
 
 
 
 
17
  }
18
  </script>
 
 
 
 
 
19
  </body>
20
  </html>
 
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>FastAPI & Chainlit Integration</title>
 
 
 
 
7
  <script>
8
+ // Function to call the custom-auth API and display the token
9
+ async function callCustomAuthApi() {
10
+ try {
11
+ const response = await fetch('/custom-auth');
12
+ const data = await response.json();
13
+ document.getElementById('apiResponse').innerText = 'Token: ' + data.token;
14
+ } catch (error) {
15
+ console.error('Error:', error);
16
+ document.getElementById('apiResponse').innerText = 'Failed to fetch token.';
17
+ }
18
  }
19
  </script>
20
+ </head>
21
+ <body>
22
+ <h1>FastAPI & Chainlit Integration</h1>
23
+ <button onclick="callCustomAuthApi()">Get Auth Token</button>
24
+ <p id="apiResponse"></p>
25
  </body>
26
  </html>