implemented dynamic theme loading, working on user edit
This commit is contained in:
@@ -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!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user