Frontend início
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
async function carregarUsuarios(){
|
||||
const tbody = document.querySelector("#conteudo_tabela_usuarios");
|
||||
|
||||
const resposta = await fetch("http://localhost:5000/api/v1/usuarios");
|
||||
const usuarios = await resposta.json();
|
||||
|
||||
usuarios.forEach(usuario => {
|
||||
const linha = document.createElement("tr");
|
||||
linha.innerHTML = `
|
||||
<td>${usuario.usuario_nome}</td>
|
||||
<td>${usuario.email}</td>
|
||||
<td>${usuario.perfil_nome}</td>
|
||||
`;
|
||||
tbody.appendChild(linha);
|
||||
});
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
carregarUsuarios();
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<table>
|
||||
<thead>
|
||||
<th>Nome</th>
|
||||
<th>E-mail</th>
|
||||
<th>Perfil</th>
|
||||
</thead>
|
||||
<tbody id="conteudo_tabela_usuarios">
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user