OpenSource Projekt-Management-Software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

33 lines
799 B

<script>
import Card from './Card.svelte';
import { onMount } from 'svelte';
import { api } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte';
import { byName } from '../../vcard.js';
let contacts = $state(null)
async function load(){
const url = api('contact/list');
const res = await fetch(url,{credentials:'include'});
if (res.ok){
yikes();
var data = await res.json();
contacts = Object.values(data).sort(byName);
console.log(contacts);
} else {
error(res);
}
}
onMount(load);
</script>
<h1>{t('contacts')}</h1>
{#each contacts as contact}
<Card {contact} />
{/each}