| 1 | import { consume } from "../libclienteweb/consume.js" |
| 2 | import { descargaVista } from "../libclienteweb/descargaVista.js" |
| 3 | import { recibeJson } from "../libclienteweb/recibeJson.js" |
| 4 | |
| 5 | descargaDatos() |
| 6 | |
| 7 | async function descargaDatos() { |
| 8 | await descargaVista("api/vista-perfil.php") |
| 9 | const botonLogout = document.querySelector("#botonLogout") |
| 10 | if (botonLogout) { |
| 11 | botonLogout.addEventListener("click", logout) |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | async function logout() { |
| 16 | await consume(recibeJson('api/logout.php')) |
| 17 | location.reload() |
| 18 | } |