import Api from "../../helpers/Api"; import UserStorage from "../../helpers/UserStorage"; export interface ISeat { id: number; classType: number; seatNumber: string; isAvailable: boolean; } export interface ISeats { $id: string; $values: ISeat[]; } export interface IFlight { id: number; origin: string; destination: string; arrivalTime: string; departureTime: string; economyCapacity: number; businessCapacity: number; economyPrice: number; businessPrice: number; seats: ISeats } export interface IAirlineDashboardData { type: 'airline' flightList: IFlight[]; } export async function GetAirlineDashboardData({request}: {request: Request}): Promise<IAirlineDashboardData> { try { const id = UserStorage.getUserId(); const response = await Api.get(`Flight?airlineId=${id}`, { withCredentials: true }); const flights = response.data.$values; return { type: 'airline', flightList: flights }; } catch (error) { throw error; } }