| 1 | <!DOCTYPE html> |
| 2 | <html lang="es"> |
| 3 | |
| 4 | <head> |
| 5 | |
| 6 | <meta charset="UTF-8"> |
| 7 | <meta name="viewport" content="width=device-width"> |
| 8 | |
| 9 | <title>Perfil</title> |
| 10 | |
| 11 | <script type="module" src="lib/js/consumeJson.js"></script> |
| 12 | <script type="module" src="lib/js/muestraError.js"></script> |
| 13 | <script type="module" src="./js/protege.js"></script> |
| 14 | <script type="module" src="./js/custom/mi-nav.js"></script> |
| 15 | |
| 16 | </head> |
| 17 | |
| 18 | <body onload="protege(nav).then(sesion => { |
| 19 | const cue = sesion.cue |
| 20 | if (cue === '') { |
| 21 | login.hidden = false |
| 22 | outputCue.value = 'No ha iniciado sesión.' |
| 23 | outputRoles.value = '' |
| 24 | } else { |
| 25 | logout.hidden = false |
| 26 | outputCue.value = cue |
| 27 | const rolIds = sesion.rolIds |
| 28 | outputRoles.value = rolIds.size === 0 |
| 29 | ? 'Sin roles' |
| 30 | : Array.from(rolIds).join(', ') |
| 31 | } |
| 32 | })"> |
| 33 | |
| 34 | <mi-nav id="nav"></mi-nav> |
| 35 | |
| 36 | <h1>Perfil</h1> |
| 37 | |
| 38 | <p> |
| 39 | <output id="outputCue"> |
| 40 | <progress max="100">Cargando…</progress> |
| 41 | </output> |
| 42 | </p> |
| 43 | |
| 44 | <p> |
| 45 | <output id="outputRoles"></output> |
| 46 | </p> |
| 47 | |
| 48 | <p> |
| 49 | |
| 50 | <a id="login" hidden href="login.html">Iniciar sesión</a> |
| 51 | |
| 52 | <button type="button" id="logout" hidden |
| 53 | onclick="consumeJson('srv/logout.php') |
| 54 | .then(json => location.reload()) |
| 55 | .catch(muestraError)"> |
| 56 | Terminar sesión |
| 57 | </button> |
| 58 | |
| 59 | </p> |
| 60 | |
| 61 | </body> |
| 62 | |
| 63 | </html> |