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 }
}
