Spaces:
Sleeping
Sleeping
Update static/index.html
Browse files- 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 |
-
<
|
| 6 |
-
</
|
| 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 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>
|