12 lines
359 B
TypeScript
12 lines
359 B
TypeScript
import { computed } from 'vue'
|
|
import { useApiResource } from '@/Composables/useApiResource'
|
|
import type { Flight } from '@/Types/types'
|
|
|
|
export function useFlights(url: string) {
|
|
const { data, loading, error } = useApiResource<Flight[]>(url)
|
|
|
|
const flights = computed(() => data.value ?? [])
|
|
|
|
return { flights, flightsLoading: loading, error }
|
|
}
|