time tracking and display of elapsed time no working
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user