Fix favorites system, add support for bus stops and tourist trips, and improve UI consistency
This commit is contained in:
@ -5,7 +5,7 @@ import { apiClient } from '@/services/apiClient'
|
||||
export interface Favorite {
|
||||
id: string
|
||||
user_id: string
|
||||
item_type: 'coupon' | 'business' | 'taxi' | 'route'
|
||||
item_type: 'coupon' | 'business' | 'taxi' | 'route' | 'stop'
|
||||
item_id: string
|
||||
item_name?: string
|
||||
item_image?: string
|
||||
@ -21,6 +21,7 @@ export const useFavoritesStore = defineStore('favorites', () => {
|
||||
const businesses = computed(() => favorites.value.filter(f => f.item_type === 'business'))
|
||||
const taxis = computed(() => favorites.value.filter(f => f.item_type === 'taxi'))
|
||||
const routes = computed(() => favorites.value.filter(f => f.item_type === 'route'))
|
||||
const stops = computed(() => favorites.value.filter(f => f.item_type === 'stop'))
|
||||
|
||||
// Actions
|
||||
async function loadFavorites() {
|
||||
@ -36,7 +37,7 @@ export const useFavoritesStore = defineStore('favorites', () => {
|
||||
}
|
||||
|
||||
async function addFavorite(
|
||||
itemType: 'coupon' | 'business' | 'taxi' | 'route',
|
||||
itemType: 'coupon' | 'business' | 'taxi' | 'route' | 'stop',
|
||||
itemId: string,
|
||||
itemName?: string,
|
||||
itemImage?: string
|
||||
@ -74,7 +75,7 @@ export const useFavoritesStore = defineStore('favorites', () => {
|
||||
}
|
||||
|
||||
async function toggleFavorite(
|
||||
itemType: 'coupon' | 'business' | 'taxi' | 'route',
|
||||
itemType: 'coupon' | 'business' | 'taxi' | 'route' | 'stop',
|
||||
itemId: string,
|
||||
itemName?: string,
|
||||
itemImage?: string
|
||||
@ -105,6 +106,7 @@ export const useFavoritesStore = defineStore('favorites', () => {
|
||||
businesses,
|
||||
taxis,
|
||||
routes,
|
||||
stops,
|
||||
loadFavorites,
|
||||
addFavorite,
|
||||
removeFavorite,
|
||||
|
||||
Reference in New Issue
Block a user