Comentarios novos para o login.js
This commit is contained in:
parent
a3583b269c
commit
9cddf02145
|
|
@ -1,3 +1,4 @@
|
|||
/* Base de comunicação com mid -abertura- */
|
||||
// Função para obter a URL base do servidor
|
||||
async function getApiUrl() {
|
||||
try {
|
||||
|
|
@ -12,6 +13,9 @@ async function getApiUrl() {
|
|||
throw error;
|
||||
}
|
||||
}
|
||||
/* -fechamento- */
|
||||
|
||||
/* Frontend - abertura - - envio da ação - */
|
||||
|
||||
// Adiciona um ouvinte de evento ao formulário de login para tratar o evento de submissão
|
||||
document.getElementById("formLogin").addEventListener("submit", async function (event) {
|
||||
|
|
@ -67,6 +71,9 @@ document.getElementById("formLogin").addEventListener("submit", async function (
|
|||
|
||||
}
|
||||
|
||||
/* Frontend - fechamento - - envio da ação - */
|
||||
|
||||
/* Nesse caso seria uma dupla utilização pois ele enviaria para o mid*/
|
||||
try {
|
||||
// Obtém a URL base do servidor
|
||||
const apiUrl = await getApiUrl();
|
||||
|
|
@ -80,8 +87,10 @@ document.getElementById("formLogin").addEventListener("submit", async function (
|
|||
body: JSON.stringify({ username, password }) // Converte os dados para JSON antes de enviar
|
||||
|
||||
});
|
||||
/* - fechamento -*/
|
||||
|
||||
|
||||
/*Frontend - Abertura - - Reação á resposta - */
|
||||
/*Caso de sucesso*/
|
||||
if (response.ok) {
|
||||
|
||||
|
|
@ -253,6 +262,6 @@ document.getElementById("formLogin").addEventListener("submit", async function (
|
|||
|
||||
}
|
||||
|
||||
|
||||
/* Frontend - fechamento - - Reação á resposta - */
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue