How do you get the result from this in svelte into the page:
async function getCities(db) {
const citiesCol = collection(db, 'cities');
const citySnapshot = await getDocs(citiesCol);
const cityList = citySnapshot.docs.map(doc => doc.data());
return cityList;
}
Thanks to @voscausa I solved it. Had to use await https://svelte.dev/tutorial/await-blocks.
let cities = getCities();
{#await cities}
<p>...waiting</p>
{:then cities}
{#each cities as city}
{city.name}
{/each}
{:catch error}
{/await}