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