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('srv/sesion-actual.php') |
19 | .then(sesion => { |
20 | nav.sesion = sesion |
21 | const cue = sesion.cue |
22 | if (cue === '') { |
23 | login.hidden = false |
24 | outputCue.value = 'No ha iniciado sesión.' |
25 | outputRoles.value = '' |
26 | } else { |
27 | logout.hidden = false |
28 | outputCue.value = cue |
29 | const rolIds = sesion.rolIds |
30 | outputRoles.value = rolIds.size === 0 |
31 | ? 'Sin roles' |
32 | : Array.from(rolIds).join(', ') |
33 | } |
34 | }) |
35 | .catch(muestraError)"> |
36 | |
37 | <mi-nav id="nav"></mi-nav> |
38 | |
39 | <h1>Perfil</h1> |
40 | |
41 | <p> |
42 | <output id="outputCue"> |
43 | <progress max="100">Cargando…</progress> |
44 | </output> |
45 | </p> |
46 | |
47 | <p> |
48 | <output id="outputRoles"> |
49 | <progress max="100">Cargando…</progress> |
50 | </output> |
51 | </p> |
52 | |
53 | <p> |
54 | |
55 | <a id="login" hidden href="login.html">Iniciar sesión</a> |
56 | |
57 | <button type="button" id="logout" hidden |
58 | onclick="consumeJson('srv/logout.php') |
59 | .then(json => location.reload()) |
60 | .catch(muestraError)"> |
61 | Terminar sesión |
62 | </button> |
63 | |
64 | </p> |
65 | |
66 | </body> |
67 | |
68 | </html> |