Commit a62ec092 authored by Adrian's avatar Adrian
Browse files

frontend

parents
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>.:: Sitio ::.</title>
<link rel="stylesheet" href="./style.css">
<script type="text/javascript">
function login () {
document.getElementById('login').style.display = 'none';
document.getElementById('data').style.display = 'block';
}
async function postData(url = '', data = {}) {
const response = await fetch(url, {
method: 'POST',
mode: 'cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json'
},
redirect: 'follow',
referrerPolicy: 'no-referrer',
body: JSON.stringify(data)
});
return await response.json();
}
function sendData () {
postData('http://localhost:5000/send', {
title: document.querySelector('#title').value,
description: document.querySelector('#description').value
})
.then((data) => {
console.log(data);
});
}
</script>
</head>
<body>
<div class="main">
<section id="login">
<form action="#" onsubmit="event.preventDefault(); login();" class="login">
<input type="text" required placeholder="Usuario">
<input type="text" required placeholder="Contraseña">
<button type="submit">ENVIAR</button>
</form>
</section>
<section id="data">
<form action="#" onsubmit="event.preventDefault(); sendData()" class="form">
<input type="text" id="title" required placeholder="Titulo">
<textarea name="comments" required placeholder="Descripción" id="description" cols="30" rows="20"></textarea>
<button type="submit">Enviar</button>
</form>
</section>
</div>
</body>
</html>
\ No newline at end of file
body {
padding: 0;
margin: 0;
}
.main {
height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.main input[type="text"] {
padding: 10px;
outline: none;
margin: 10px;
width: calc(100% - 40px);
}
.main button[type="submit"] {
padding: 10px 0;
outline: none;
margin: 10px;
border-radius: 7px;
background: #0c4263;
border: none;
width: calc(100% - 40px);
color: #FFF;
cursor: pointer;
}
textarea {
margin: auto;
width: calc(95% - 20px);
padding: 10px;
outline: none;
}
#login {
display: block;
}
.login {
width: 40vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 10px;
border: 1px solid rgb(184, 178, 178);
padding: 20px;
}
#data {
display: none;
}
.form {
border: 1px solid rgb(223, 223, 223);
padding: 20px;
width: 40vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment