time tracking and display of elapsed time no working

This commit is contained in:
2025-08-27 13:43:02 +02:00
parent 72375b82cf
commit f1d0d69455
11 changed files with 140 additions and 34 deletions

View File

@@ -3,14 +3,22 @@ export const user = $state({
theme : 'default'
})
export const timetrack = $state({running:null});
export async function checkUser(){
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/whoami`;
const response = await fetch(url,{
credentials: 'include'
});
if (response.ok){
const json = await response.json();
let url = `${location.protocol}//${location.host.replace('5173','8080')}/api/user/whoami`;
let resp = await fetch(url,{credentials: 'include'});
if (resp.ok){
const json = await resp.json();
for (let key of Object.keys(json)) user[key] = json[key];
url = `${location.protocol}//${location.host.replace('5173','8080')}/api/time/started`;
resp = await fetch(url,{credentials: 'include'});
}
if (resp.ok){
const track = await resp.json();
timetrack.running = track;
}
}