Start to think about how to display errors

This commit is contained in:
jude
2023-08-19 22:37:48 +01:00
parent ea3fe3f543
commit adf29dca5d
7 changed files with 20 additions and 40 deletions

View File

@ -18,6 +18,7 @@ const $downloader = document.querySelector("a#downloader");
const $uploader = document.querySelector("input#uploader");
let channels = [];
let reminderErrors = [];
let guildNames = {};
let roles = [];
let templates = {};
@ -36,6 +37,12 @@ function guildId() {
return document.querySelector(".guildList a.is-active").dataset["guild"];
}
function loadErrors() {
return fetch(`/dashboard/api/guild/${guildId()}/errors`).then((response) =>
response.json()
);
}
function colorToInt(r, g, b) {
return (r << 16) + (g << 8) + b;
}
@ -476,6 +483,9 @@ document.addEventListener("guildSwitched", async (e) => {
fetch_roles(e.detail.guild_id);
fetch_templates(e.detail.guild_id);
fetch_reminders(e.detail.guild_id);
loadErrors().then((res) => {
console.log(res);
});
document.querySelectorAll("p.pageTitle").forEach((el) => {
el.textContent = `${e.detail.guild_name} Reminders`;

View File

@ -1,19 +0,0 @@
let _reminderErrors = [];
const reminderErrors = () => {
return _reminderErrors;
}
const guildId = () => {
let selected = document.querySelector(".guildList a.is-active");
return selected.dataset["guild"];
}
function loadErrors() {
fetch(`/dashboard/api/guild/${guildId()}/errors`).then(response => response.json())
}
document.addEventListener('DOMContentLoaded', () => {
})

View File

@ -1,19 +0,0 @@
let _reminderErrors = [];
const reminderErrors = () => {
return _reminderErrors;
}
const guildId = () => {
let selected: HTMLElement = document.querySelector(".guildList a.is-active");
return selected.dataset["guild"];
}
function loadErrors() {
fetch(`/dashboard/api/guild/${guildId()}/errors`).then(response => response.json())
}
document.addEventListener('DOMContentLoaded', () => {
})