implemented dynamic theme loading, working on user edit

This commit is contained in:
2025-07-01 22:24:23 +02:00
parent 691c317a57
commit 684e0b00dd
12 changed files with 178 additions and 61 deletions

View File

@@ -1,8 +1,10 @@
export const user = $state({
name : null
name : null,
theme : 'default'
})
export async function checkUser(){
console.log('checkUser()');
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/whoami`;
const response = await fetch(url,{
credentials: 'include'
@@ -34,6 +36,7 @@ export async function tryLogin(credentials){
if (response.ok){
const json = await response.json();
for (let key of Object.keys(json)) user[key] = json[key];
} else {
alert("Login failed!");
}