fix: critical bug fixes - routes UUID, image paths, favorites loading, bottom nav debounce
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { businessService } from '@/services/businessService'
|
||||
import { API_URL } from '@/services/apiClient'
|
||||
import type { Business } from '@/types'
|
||||
import { useRouter } from 'vue-router'
|
||||
import FavoriteButton from '@/components/FavoriteButton.vue'
|
||||
import { analyticsService } from '@/services/analyticsService'
|
||||
import { getImageUrl } from '@/utils/imageUrl'
|
||||
|
||||
const router = useRouter()
|
||||
const businesses = ref<Business[]>([])
|
||||
@ -98,11 +98,6 @@ function handleExplore(biz: Business) {
|
||||
router.push('/business/' + biz.id)
|
||||
}
|
||||
|
||||
function getImageUrl(path?: string | null) {
|
||||
if (!path) return `https://ui-avatars.com/api/?name=Negocio&background=fee715&color=101820&size=200&bold=true`
|
||||
if (path.startsWith('http')) return path
|
||||
return `${API_URL}${path.startsWith('/') ? '' : '/'}${path}`
|
||||
}
|
||||
|
||||
function resetFilters() {
|
||||
selectedCategory.value = 'Todas'
|
||||
@ -209,7 +204,12 @@ function resetFilters() {
|
||||
@click="handleExplore(biz)"
|
||||
>
|
||||
<div class="biz-img-wrap">
|
||||
<img :src="getImageUrl(biz.image_url)" :alt="biz.name" class="biz-img" />
|
||||
<img
|
||||
:src="getImageUrl(biz.image_url, 'business')"
|
||||
:alt="biz.name"
|
||||
class="biz-img"
|
||||
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'business')"
|
||||
/>
|
||||
<div class="biz-fav">
|
||||
<FavoriteButton item-type="business" :item-id="biz.id" :item-name="biz.name" :item-image="biz.image_url || undefined" />
|
||||
</div>
|
||||
@ -274,7 +274,12 @@ function resetFilters() {
|
||||
class="featured-card"
|
||||
@click="handleExplore(biz)"
|
||||
>
|
||||
<img :src="getImageUrl(biz.image_url)" :alt="biz.name" class="featured-img" />
|
||||
<img
|
||||
:src="getImageUrl(biz.image_url, 'business')"
|
||||
:alt="biz.name"
|
||||
class="featured-img"
|
||||
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'business')"
|
||||
/>
|
||||
<div class="featured-gradient"></div>
|
||||
<div class="featured-fav">
|
||||
<FavoriteButton item-type="business" :item-id="biz.id" :item-name="biz.name" :item-image="biz.image_url || undefined" />
|
||||
@ -305,7 +310,12 @@ function resetFilters() {
|
||||
@click="handleExplore(biz)"
|
||||
>
|
||||
<div class="biz-img-wrap">
|
||||
<img :src="getImageUrl(biz.image_url)" :alt="biz.name" class="biz-img" />
|
||||
<img
|
||||
:src="getImageUrl(biz.image_url, 'business')"
|
||||
:alt="biz.name"
|
||||
class="biz-img"
|
||||
@error="(e) => (e.target as HTMLImageElement).src = getImageUrl(null, 'business')"
|
||||
/>
|
||||
<div class="biz-fav">
|
||||
<FavoriteButton item-type="business" :item-id="biz.id" :item-name="biz.name" :item-image="biz.image_url || undefined" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user