auto_spot/frontend/src/services/vehicleService.js
Linas f7dddc220d Initial commit: Auto Spot frontend prototype
React + Vite frontend with bilingual EN/RU support, vehicle listings,
detail pages with photo gallery, and dummy vehicle data. Spring Boot
backend scaffold included.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 21:38:28 +03:00

27 lines
580 B
JavaScript

import { vehicles } from '../data/vehicles.js'
export function getAllVehicles() {
return vehicles
}
export function getVehicleById(id) {
return vehicles.find(v => v.id === Number(id)) ?? null
}
export function getVehiclesByType(type) {
return vehicles.filter(v => v.type === type)
}
export function getFeaturedVehicles(limit = 6) {
return vehicles.slice(0, limit)
}
export function getStats() {
return {
cars: vehicles.filter(v => v.type === 'car').length,
trucks: vehicles.filter(v => v.type === 'truck').length,
sellers: 540,
rating: '4.8',
}
}