fix username not being shown

This commit is contained in:
Mystikfluu 2022-08-27 00:26:09 +02:00
parent 30a09f4c6f
commit cc4e2ce590

View File

@ -235,13 +235,15 @@ async function main(){
user = await (await fetch("/api/getuser")).json() user = await (await fetch("/api/getuser")).json()
username = user.username username = user.username
if(!username){ if(!username){
user = undefined
document.getElementById("noaccount").style="" document.getElementById("noaccount").style=""
document.getElementById("loading").style="display:none;" document.getElementById("loading").style="display:none;"
console.log("no account"); console.log("no account");
return; return;
} }
document.getElementById("username-self").innerText = username
} }
username = user.username
document.getElementById("username-self").innerText = username
let all_posts = await (await fetch(`/api/getPosts?channel=${currentChannel}`)).json() let all_posts = await (await fetch(`/api/getPosts?channel=${currentChannel}`)).json()
if(!all_posts)return; if(!all_posts)return;