add event submit

This commit is contained in:
Valentin CZERYBA 2022-07-20 22:54:46 +02:00
parent eb36c8d386
commit 1eb459c44b
2 changed files with 17 additions and 8 deletions

View File

@ -15,8 +15,7 @@
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="js/config.js"></script>
<script src="js/login.js"></script>
<!-- Favicons -->
<link rel="apple-touch-icon" href="https://getbootstrap.com/docs/5.1/assets/img/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="https://getbootstrap.com/docs/5.1/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
@ -50,12 +49,12 @@
<body class="text-center">
<main class="form-signin">
<form>
<form id="signin">
<img class="mb-4" src="css/bootstrap-logo.svg" alt="" width="72" height="57">
<h1 class="h3 mb-3 fw-normal">Please sign in</h1>
<div class="form-floating">
<input type="email" class="form-control" id="floatingInput" placeholder="name@example.com">
<input type="email" class="form-control" id="floatingEmail" placeholder="name@example.com">
<label for="emailInput">Email address</label>
</div>
<div class="form-floating">
@ -76,5 +75,6 @@
<script src="js/config.js"></script>
<script src="js/login.js"></script>
</body></html>

View File

@ -3,3 +3,12 @@ instance.get("token", { withCredentials: true})
.catch(function(error){
});
document.getElementById("signin").addEventListener("submit", function(evt){
evt.preventDefault();
var email = document.getElementById("floatingEmail");
var password = document.getElementById("floatingPassword");
if((password.value.length > 0) || (email.value.length > 0)){
console.log("request");
}
})