blob: 56a7e33f9f0f7296d52435825d52f6c631e5aea4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<script>
import PersonCard from './PersonCard.svelte';
import { onMount } from 'svelte';
import { supabase } from '$lib/supabase';
const getPeople = async () => {
const { data, error } = await supabase.from('people').select();
if (!error) {
return data;
}
console.log(error);
return [];
}
const mapImages = (people) => {
return people.map((x) => {
const { publicURL, error } = supabase
.storage
.from('mistymountains')
.getPublicUrl(x.image);
if (!error) {
return { ...x, image: publicURL };
}
return x;
});
}
let people = [];
onMount(async () => {
people = await getPeople().then(mapImages);
});
</script>
<main>
{#if people.length}
{#each people as person, i}
<div class="row">
<PersonCard person={person} direction={i % 2 ? 'left' : 'right'} />
</div>
{/each}
{/if}
</main>
|