Odoo GraphQL Subscription using Node, Express JS for Sample
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.8 KiB

5 months ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
</head>
<body>
<h2>Login</h2>
<form id="loginForm">
<label for="username">Username:</label><br>
<input type="text" id="username" name="username" required><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password" required><br><br>
<button type="submit">Submit</button>
</form>
<script>
document.getElementById("loginForm").addEventListener("submit", function(event) {
event.preventDefault(); // Prevent default form submission
// Get form data
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
// Construct request body
const requestBody = {
username: username,
password: password
};
// Make POST request
fetch("YOUR_API_ENDPOINT", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify(requestBody)
})
.then(response => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.then(data => {
console.log("Response:", data);
})
.catch(error => {
console.error("Error:", error);
});
});
</script>
</body>
</html>