summaryrefslogtreecommitdiff
path: root/static/main.js
diff options
context:
space:
mode:
authorDaniel Hader <[email protected]>2026-05-30 13:21:00 -0500
committerDaniel Hader <[email protected]>2026-05-30 13:21:00 -0500
commit5e19bada513378eda6a16d7ea13a0db9679e3836 (patch)
tree698bcf236fed033e2e0d7e24f014c9ed89ca48d3 /static/main.js
parentbcff4d006a0600ecf86f18ecdaa74e0df31766f0 (diff)
favicon
Diffstat (limited to 'static/main.js')
-rw-r--r--static/main.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/static/main.js b/static/main.js
index 4af948a..23bb356 100644
--- a/static/main.js
+++ b/static/main.js
@@ -1,13 +1,17 @@
async function me() {
- const response = await fetch("/me");
- if (response.ok) {
- const result = await response.json();
- // this is technically a XSS risk (TODO: deal with it)
- // in principle it only affects the person who chose their username, but...
- document.getElementById("logged-in").innerHTML = `Logged in as ${result.username}`;
- document.getElementById("logout-links").hidden = false;
- } else {
- document.getElementById("login-links").hidden = false;
+ try {
+ const response = await fetch("/me");
+ if (response.ok) {
+ const result = await response.json();
+ // this is technically a XSS risk (TODO: deal with it)
+ // in principle it only affects the person who chose their username, but...
+ document.getElementById("logged-in").innerHTML = `Logged in as ${result.username}`;
+ document.getElementById("logout-links").hidden = false;
+ } else {
+ document.getElementById("login-links").hidden = false;
+ }
+ } catch (error) {
+ console.log("hi");
}
}