cleaning up javascript code
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
<script>
|
||||
import {onMount} from 'svelte';
|
||||
import {t} from '../translations.svelte.js';
|
||||
let { caption, onselect = (contact) => console.log('selected '+contact.FN||contact.ORG) } = $props();
|
||||
let message = t('loading');
|
||||
|
||||
import {api} from '../urls.svelte.js';
|
||||
import {t} from '../translations.svelte.js';
|
||||
|
||||
let {
|
||||
caption,
|
||||
onselect = (contact) => console.log('selected '+contact.FN||contact.ORG)
|
||||
} = $props();
|
||||
|
||||
let contacts = $state(null);
|
||||
let value = 0;
|
||||
let message = t('loading');
|
||||
let value = 0;
|
||||
|
||||
async function loadContacts(){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/document/contacts`;
|
||||
var resp = await fetch(url,{ credentials: 'include'});
|
||||
const url = api('document/contacts');
|
||||
const resp = await fetch(url,{ credentials: 'include'});
|
||||
if (resp.ok){
|
||||
contacts = await resp.json();
|
||||
} else {
|
||||
message = await resp.text();
|
||||
message = await resp.text();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +28,6 @@
|
||||
}
|
||||
|
||||
onMount(loadContacts)
|
||||
|
||||
</script>
|
||||
|
||||
{#if contacts}
|
||||
|
||||
Reference in New Issue
Block a user