showing username over the textarea now
This commit is contained in:
parent
81358f3c28
commit
b2d8c7ac84
@ -7,7 +7,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="self">
|
<div class="self">
|
||||||
Username: <span class="Username"></span> <br>
|
Username: <span class="Username" id="username-self"></span> <br>
|
||||||
<textarea name="name" id="post-text" rows="8" cols="80"></textarea> <br>
|
<textarea name="name" id="post-text" rows="8" cols="80"></textarea> <br>
|
||||||
<button type="button" name="button" id="post-btn">Post</button>
|
<button type="button" name="button" id="post-btn">Post</button>
|
||||||
</div>
|
</div>
|
||||||
@ -46,8 +46,18 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setUsername() {
|
||||||
|
let user = await (await fetch("/api/getuser")).json()
|
||||||
|
let username = user.username
|
||||||
|
if(!username)username = user.error
|
||||||
|
document.getElementById("username-self").innerText = username
|
||||||
|
}
|
||||||
|
|
||||||
|
setUsername()
|
||||||
buildPosts()
|
buildPosts()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user