Add TS interface for location on Shop module

This commit is contained in:
2021-12-06 15:05:23 +01:00
parent bb8d33b3d8
commit e920a162f8

View File

@@ -4,15 +4,20 @@
import Button from '$components/atoms/Button.svelte' import Button from '$components/atoms/Button.svelte'
import Image from '$components/atoms/Image.svelte' import Image from '$components/atoms/Image.svelte'
const { locations, shop } = getContext('global') interface Location {
slug: string
name: string
has_poster: boolean
}
const { locations, shop } = getContext('global')
const locationsWithPoster = locations const locationsWithPoster = locations
// Filter locations with posters only // Filter locations with posters only
.filter((loc: any) => loc.has_poster) .filter((loc: Location) => loc.has_poster)
// Sort locations alphabetically from slug (a>z) // Sort locations alphabetically from slug (a>z)
.sort((a: any, b: any) => a.slug.localeCompare(b.slug)) .sort((a: Location, b: Location) => a.slug.localeCompare(b.slug))
// Return name only // Return name only
.map((loc: any) => loc.name) .map((loc: Location) => loc.name)
</script> </script>
<div class="shop shadow-box-dark"> <div class="shop shadow-box-dark">