1 | import { exportaAHtml } from "../lib/js/exportaAHtml.js" |
2 | import { htmlentities } from "../lib/js/htmlentities.js" |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | export function renderiza(lista, pasatiempos) { |
9 | let render = "" |
10 | for (const modelo of pasatiempos) { |
11 | if (modelo.PAS_ID === undefined) |
12 | throw new Error(`Falta PAS_ID de ${modelo.PAS_NOMBRE}.`) |
13 | const nombre = htmlentities(modelo.PAS_NOMBRE) |
14 | const searchParams = new URLSearchParams([["id", modelo.PAS_ID]]) |
15 | const params = htmlentities(searchParams.toString()) |
16 | render += |
17 | `<li> |
18 | <p><a href="modifica.html?${params}">${nombre}</a></p> |
19 | </li>` |
20 | } |
21 | lista.innerHTML = render |
22 | } |
23 | |
24 | exportaAHtml(renderiza) |