Sort Shop locations alphabetically

This commit is contained in:
2021-11-21 13:50:44 +01:00
parent 1a48d408ab
commit 7e29caf2c2

View File

@@ -7,7 +7,11 @@
const { locations, shop } = getContext('global') const { locations, shop } = getContext('global')
const locationsWithPoster = locations const locationsWithPoster = locations
// Filter locations with posters only
.filter((loc: any) => loc.has_poster) .filter((loc: any) => loc.has_poster)
// Sort locations alphabetically from slug (a>z)
.sort((a: any, b: any) => a.slug.localeCompare(b.slug))
// Return name only
.map((loc: any) => loc.name) .map((loc: any) => loc.name)
</script> </script>