abtmtr-v4/views/about/scripts/data_get_domain.js

23 lines
589 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>${subdomain.name}</h1>
${subdomain.description.reduce(
(html, descfragment) => html + `<p>${descfragment}</p>`,
""
)}
<p>
<button
onclick="window.open('${subdomain.url}')"
>
Open
</button>
</p>`,
""
);
});