diff options
| author | Fuwn <[email protected]> | 2024-04-13 02:35:18 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-04-13 02:35:18 -0700 |
| commit | 841e509c491f7bfc96361a7088e1750aee167f05 (patch) | |
| tree | 5b8f0e4674d1a15ff480147b7455b2030a15b4cf /src/routes/user | |
| parent | feat(user): markdown biography (diff) | |
| download | due.moe-841e509c491f7bfc96361a7088e1750aee167f05.tar.xz due.moe-841e509c491f7bfc96361a7088e1750aee167f05.zip | |
feat(user): biography option
Diffstat (limited to 'src/routes/user')
| -rw-r--r-- | src/routes/user/[user]/+page.svelte | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/routes/user/[user]/+page.svelte b/src/routes/user/[user]/+page.svelte index 7cffd647..71d03e37 100644 --- a/src/routes/user/[user]/+page.svelte +++ b/src/routes/user/[user]/+page.svelte @@ -63,6 +63,9 @@ const getBadgeWallCSS = () => (document.getElementById('badgeWallCSS') as HTMLTextAreaElement).value; + const getBiography = () => + (document.getElementById('biography') as HTMLTextAreaElement).value.slice(0, 3000); + // 8.5827814569536423841e0 </script> @@ -211,7 +214,33 @@ <p /> + Biography + + <button + on:click={() => { + if (userData) + fetch(root(`/api/preferences?id=${userData.id}&biography`), { + method: 'PUT', + body: getBiography() + }).then(() => + fetch(root(`/api/preferences?id=${userData?.id}`)) + .then((rawPreferences) => rawPreferences.json()) + .then((JSONpreferences) => (preferences = JSONpreferences)) + ); + }}>Save</button + > + <textarea + value={preferences.biography} + rows="5" + cols="100" + id="biography" + placeholder="Markdown supported!" + /> + + <p /> + Badge Wall Custom CSS + <button on:click={() => { if (userData) |