code cleanup

This commit is contained in:
2025-07-30 09:03:47 +02:00
parent a77efb4e41
commit 631a527a5d
18 changed files with 257 additions and 184 deletions

View File

@@ -1,20 +1,25 @@
<script>
import { t } from '../../translations.svelte.js';
import { onMount } from 'svelte';
let { company_id, onSelect = (time) => {} } = $props();
import { api } from '../../urls.svelte.js';
import { t } from '../../translations.svelte.js';
let {
company_id,
onSelect = (time) => {}
} = $props();
let error = $state(null);
let projects = $state(null);
let times = $state(null);
let error = $state(null);
let times = $state(null);
async function loadProjects(){
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/project/list`;
let data = { company_id: company_id };
const url = api'project/list');
let data = { company_id: company_id };
const resp = await fetch(url,{
credentials:'include',
method: 'POST',
body: JSON.stringify(data)
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
if (resp.ok){
projects = await resp.json();
@@ -24,12 +29,12 @@
}
async function loadTimes(projectId){
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/times/list`;
const url = api('times/list');
let data = { company_id: company_id, project_id: projectId };
const resp = await fetch(url,{
credentials:'include',
method: 'POST',
body: JSON.stringify(data)
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
if (resp.ok){
times = await resp.json();