-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
logout - front, identa codigo e implementa layout cabeçalho, estabili…
…za(?) thead no index.html, identa inserePub
- Loading branch information
Showing
5 changed files
with
79 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-BR"> | ||
|
||
<head> | ||
<script src="javascript/autenticacao.js"></script> | ||
<script src="javascript/constantes.js"></script> | ||
<style> | ||
#unlogged, #logged, #identificacao { | ||
display: inline-block; /* Set to inline-block for horizontal alignment */ | ||
margin-right: 10px; /* Adjust the margin as needed for spacing */ | ||
#unlogged, | ||
#logged, | ||
#identificacao { | ||
display: inline-block; | ||
/* Set to inline-block for horizontal alignment */ | ||
margin-right: 10px; | ||
/* Adjust the margin as needed for spacing */ | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<a href="/" target="_top">Home</a> | ||
<div id="unlogged" class="visivel"> | ||
| <a href="login.html" target="_top">Login</a> | ||
| <a href="login.html" target="_top">Login</a> | ||
</div> | ||
<div id="logged" class="invisivel"> | ||
| <a href="logout.html" target="_top">Logout</a> | ||
</div> | ||
| Você é <div id="identificacao" class="mesmaLinha">visitante</div> | ||
<a style="color: white;">| Você é <div id="identificacao" class="mesmaLinha">visitante</div> | ||
</a> | ||
<hr> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Document</title> | ||
<script src="javascript/logout.js"></script> | ||
<script src="javascript/constantes.js"></script> | ||
</head> | ||
|
||
<body> | ||
<iframe src="cabecalho.html" frameborder="0" width="100%" height="50" id="cabecalho"></iframe> | ||
<p> | ||
Confirme logout clicando | ||
<button type="button" id="logout">aqui</button>. | ||
</p> | ||
<div id="mensagem"></div> | ||
</body> | ||
|
||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
onload = (evento) => { | ||
(document.getElementById('logout') as HTMLInputElement).addEventListener('click', (evento) => { | ||
console.log("Clickei!") | ||
const token = localStorage.getItem('token'); | ||
fetch(backendAddress + 'accounts/token-auth/', { | ||
method: 'DELETE', | ||
headers: { | ||
'Authorization': 'Token ' + token, | ||
'Content-Type': 'application/json' | ||
} | ||
}) | ||
.then(response => { | ||
const mensagem = document.getElementById('mensagem') as HTMLDivElement; | ||
if (response.ok) { | ||
window.location.assign('/'); | ||
} else { | ||
mensagem.innerHTML = 'Erro ' + response.status; | ||
} | ||
}) | ||
.catch(erro => { | ||
console.log(erro); | ||
}); | ||
}); | ||
} | ||
|