First Commit

This commit is contained in:
2023-09-10 23:50:05 +04:00
commit 6d45d1c604
61 changed files with 19953 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<title>Login Example</title>
</head>
<body>
<form id="loginForm">
<!-- Your login input fields go here -->
<input type="text" name="email" placeholder="email">
<input type="password" name="password" placeholder="Password">
<button type="submit">Login</button>
</form>
<script>
// Function to handle the form submission
function handleSubmit(event) {
event.preventDefault();
const form = document.getElementById('loginForm');
const formData = new FormData(form);
fetch('/login', {
method: 'POST', // Adjust the HTTP method if needed
body: formData,
})
.then(response => response.json())
.then(data => {
const accessToken = data.access_token;
console.log(accessToken);
document.cookie = `access_token=${accessToken}`;
})
.catch(error => {
console.error('Login error:', error);
});
}
// Add a submit event listener to the form
const loginForm = document.getElementById('loginForm');
loginForm.addEventListener('submit', handleSubmit);
</script>
</body>
</html>