From 98f612774cd0fa1f11b4166a0c7656722152aba1 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sun, 12 Feb 2023 16:44:45 -0500 Subject: update dependicies, fix profile page --- public/js/main.js | 3 ++- public/js/profile.js | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'public/js') diff --git a/public/js/main.js b/public/js/main.js index 9993cee..3ad36b0 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -66,6 +66,7 @@ export function form(attrs, ...children) { } export function img(attrs, ...children) { + attrs['onerror'] = (event) => event.target.remove() return createElement("img", attrs, ...children) } @@ -102,7 +103,7 @@ export function pfp(id) { } export function banner(id) { - return img({src: `/image/banner?user_id=${id}`, onerror: () => {this.remove()}}) + return img({src: `/image/banner?user_id=${id}`}) } const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', diff --git a/public/js/profile.js b/public/js/profile.js index b053b5d..8322ef0 100644 --- a/public/js/profile.js +++ b/public/js/profile.js @@ -198,9 +198,15 @@ async function load(id) { } const posts = (await loadusersposts(id, page)).json + if (posts == undefined) { + posts = [] + } if (posts.length < 1) { - document.getElementsByClassName('loadp')[0].remove() + let el = document.getElementsByClassName('loadp')[0] + if (el) { + el.remove() + } return [] } else { page++ @@ -213,7 +219,11 @@ async function load(id) { } if (batch.length != 0) { - const users = await loadusers(batch).json + const users = (await loadusers(batch)).json + if (users == undefined) { + users = [] + } + for (const user of users) { data.users[user.user_id] = user } -- cgit v1.2.3-freya