15 lines
369 B
TypeScript
15 lines
369 B
TypeScript
import { Heliport, Prisma } from "@repo/db";
|
|
import axios from "axios";
|
|
|
|
export const getHeliportsAPI = async (filter?: Prisma.HeliportWhereInput) => {
|
|
const res = await axios.get<Heliport[]>("/api/heliports", {
|
|
params: {
|
|
filter: JSON.stringify(filter),
|
|
},
|
|
});
|
|
if (res.status !== 200) {
|
|
throw new Error("Failed to fetch heliports");
|
|
}
|
|
return res.data;
|
|
};
|