Added Notifications
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// useFlights.ts
|
||||
import {onMounted, ref} from "vue";
|
||||
import {Flight} from "@/Types/types";
|
||||
import axios from "axios";
|
||||
|
||||
export function useFlights(url: string) {
|
||||
const flights = ref<Flight[]>([])
|
||||
const flightsLoading = ref(true)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const response = await axios.get(url)
|
||||
flights.value = response.data
|
||||
} finally {
|
||||
flightsLoading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
return { flights, flightsLoading }
|
||||
}
|
||||
Reference in New Issue
Block a user