outposts: load token async

This commit is contained in:
Jens Langhammer
2020-10-04 00:29:18 +02:00
parent 189b0ec324
commit d3a96ac7aa
2 changed files with 12 additions and 1 deletions

View File

@ -7,6 +7,7 @@ document.querySelectorAll("button.pf-c-dropdown__toggle").forEach((b) => {
});
});
// Search clearing
document.querySelectorAll("input[type=search]").forEach((si) => {
si.addEventListener("search", (e) => {
if (si.value === "") {
@ -15,6 +16,16 @@ document.querySelectorAll("input[type=search]").forEach((si) => {
});
});
// Fetch from data-attributes
document.querySelectorAll("[data-pb-fetch-fill]").forEach((el) => {
const url = el.dataset.pbFetchFill;
const key = el.dataset.pbFetchKey;
fetch(url).then(r => r.json()).then(r => {
el.textContent = r[key];
el.value = r[key];
});
});
// Modal
document.querySelectorAll("[data-target='modal']").forEach((m) => {
m.addEventListener("click", (e) => {