Skip to content

Commit 66ebae8

Browse files
Filter enabled field on map locations
1 parent 05bab06 commit 66ebae8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

components/block/MapBusiness.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,21 @@ const cityName = computed(() => {
145145
// {
146146
// lazy: true
147147
// })
148-
interface Locations {
148+
interface LocationItem {
149+
address: string
150+
category: string
151+
enabled: boolean
152+
gmaps: string
149153
name: string
154+
photo: string
155+
id: number
150156
}
151157
const getPosts = async () => {
152-
const data = await $fetch(`https://mycbdmurjytbdahjljoh.supabase.co/rest/v1/rpc/get_cryptocity_locations?cryptocity_name=${cityName.value}&apikey=${useRuntimeConfig().public.SUPA_KEY}`)
158+
const data: Array<LocationItem> = await $fetch(`https://mycbdmurjytbdahjljoh.supabase.co/rest/v1/rpc/get_cryptocity_locations?cryptocity_name=${cityName.value}&apikey=${useRuntimeConfig().public.SUPA_KEY}`)
159+
const filteredData = data.filter((location: LocationItem) => location.enabled === true)
153160
store.locations.push({
154161
name: cityName.value,
155-
cityLocations: data as Array<Locations>
162+
cityLocations: filteredData as Array<LocationItem>
156163
})
157164
}
158165

0 commit comments

Comments
 (0)