diff options
| author | Adam Soltys <[email protected]> | 2022-12-19 20:55:21 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-12-19 20:55:21 -0800 |
| commit | ca70bc2d452dd1bb942ae4a2e060a9db5021f6a4 (patch) | |
| tree | 9cd1df7a9b54e035fe3663e3277f3c3edc8a51d1 /src | |
| parent | 2f49bcc99b75076d8f5e0b1619f8878d91b17629 (diff) | |
| download | coinos-ui-ca70bc2d452dd1bb942ae4a2e060a9db5021f6a4.tar.gz coinos-ui-ca70bc2d452dd1bb942ae4a2e060a9db5021f6a4.zip | |
move locations check
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/About.svelte | 16 | ||||
| -rw-r--r-- | src/routes/(app)/locations/+server.js | 12 | ||||
| -rw-r--r-- | src/routes/+page.svelte | 5 |
3 files changed, 21 insertions, 12 deletions
diff --git a/src/components/About.svelte b/src/components/About.svelte index 317c190e..c05f2dc2 100644 --- a/src/components/About.svelte +++ b/src/components/About.svelte @@ -85,10 +85,12 @@ </div> </div> -<div> - <h3 class="text-5xl font-medium mb-5 text-center">{$t('about.locations.header')}</h3> - <p class="text-secondary text-xl w-full md:w-10/12 lg:w-2/3 2xl:w-[800px] mx-auto mb-10"> - {@html $t('about.locations.description')} - </p> - <LocationsMap {locations} /> -</div> +{#if locations?.length} + <div> + <h3 class="text-5xl font-medium mb-5 text-center">{$t('about.locations.header')}</h3> + <p class="text-secondary text-xl w-full md:w-10/12 lg:w-2/3 2xl:w-[800px] mx-auto mb-10"> + {@html $t('about.locations.description')} + </p> + <LocationsMap {locations} /> + </div> +{/if} diff --git a/src/routes/(app)/locations/+server.js b/src/routes/(app)/locations/+server.js index 87f8975d..dd9e984b 100644 --- a/src/routes/(app)/locations/+server.js +++ b/src/routes/(app)/locations/+server.js @@ -2,6 +2,14 @@ import { get } from '$lib/utils'; import { json } from '@sveltejs/kit'; export async function GET({ fetch, setHeaders }) { - setHeaders({ 'cache-control': 'public, max-age=600' }); - return json(await get('/locations')); + let locations = []; + + try { + ({ locations } = await get('/locations')); + setHeaders({ 'cache-control': 'public, max-age=600' }); + } catch (e) { + console.log('failed to fetch locations'); + } + + return json({ locations }); } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index dd135b1b..bf191b7f 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -17,6 +17,7 @@ export let data; let { user } = data; let { locations } = data; + console.log('LOCATIONS', locations); let howItWorks; let faq; @@ -93,9 +94,7 @@ <div bind:this={about} /> </div> - {#if locations?.length} - <About {locations} /> - {/if} + <About {locations} /> </main> <Footer /> |
