Deleted public index.html

pull/76/head
Skultrix 2023-11-30 12:54:28 +03:00
rodzic f9d89ec9e8
commit 55e084f11b
1 zmienionych plików z 0 dodań i 128 usunięć

Wyświetl plik

@ -1,128 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Invoke Netlify Function</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
text-align: center;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
}
h1 {
color: #000;
}
form {
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
max-width: 400px;
width: 100%;
text-align: left; /* Left-align form elements */
}
label {
display: block;
margin-bottom: 8px;
color: #555;
font-weight: bold;
}
input[type="text"] {
width: 100%;
padding: 12px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.button-container {
display: flex;
justify-content: center;
}
input[type="submit"] {
background-color: #3fbfff;
color: #fff;
border: none;
padding: 12px 24px;
cursor: pointer;
border-radius: 4px;
font-weight: bold;
margin: 0 auto; /* Center the button horizontally */
}
input[type="submit"]:hover {
background-color: #1177e4;
}
#result {
margin-top: 20px;
padding: 10px;
background-color: transparent;
border: none;
max-width: 400px;
width: 100%;
white-space: nowrap; /* Prevent wrapping to the next line */
/* overflow: hidden; Hide the overflow */
text-align: center; /* Center-align text in result div */
margin-left: auto; /* Move to the center horizontally */
margin-right: auto; /* Move to the center horizontally */
}
</style>
</head>
<body>
<h1>Invoke Netlify Function</h1>
<form id="invokeForm" action="https://us-central-learbdb-cmuq.cloudfunctions.net/handle" method="POST" onsubmit="invokeFunction(event)">
<label for="url">URL:</label>
<input type="text" id="url" name="url" value="https://example.com">
<label for="apiKey">API Key:</label>
<input type="text" id="apiKey" name="apiKey" value="your-api-key">
<div class="button-container">
<input type="submit" value="Invoke Function">
</div>
</form>
<div id="result"></div>
<script>
async function invokeFunction(event) {
event.preventDefault(); // Prevent the default form submission behavior
const url = document.getElementById("url").value;
const apiKey = document.getElementById("apiKey").value;
const formData = { url, apiKey };
try {
const response = await fetch("https://us-central-learbdb-cmuq.cloudfunctions.net/handle", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(formData)
});
const data = await response.json();
// Display the result in the "result" div
document.getElementById("result").innerHTML = JSON.stringify(data, null, 2);
} catch (error) {
console.error("Error:", error);
}
}
</script>
</body>
</html>