abtmtr-v4/views/domain/scripts/data_get_domain.js
2023-12-21 00:23:50 -06:00

14 lines
559 B
JavaScript

const data_get = document.getElementById("data_get");
fetch("https://blog.abtmtr.link/api/collections/paste/posts/domain")
.then((x) => x.json())
.then((paste) => {
const data = JSON.parse(paste.data.body);
data_get.innerHTML = data.reduce(
(html, subdomain) =>
html +
`<h1><a href="${subdomain.url}" target="_blank">${subdomain.name}</a></h1>
${subdomain.description.map((x) => `<p>${x}</p>`).join("")}
<img src="${subdomain.src}" alt="${subdomain.name}" title="${subdomain.name}" />`,
""
);
});