code cleanup
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user