futher booking stuff
This commit is contained in:
@@ -18,9 +18,10 @@ export const getBookingsAPI = async (filter: Prisma.BookingWhereInput) => {
|
||||
return res.data;
|
||||
};
|
||||
|
||||
export const createBookingAPI = async (booking: Prisma.BookingCreateInput) => {
|
||||
export const createBookingAPI = async (booking: Omit<Prisma.BookingCreateInput, "User">) => {
|
||||
const response = await axios.post("/api/bookings", booking);
|
||||
if (response.status !== 201) {
|
||||
console.error("Error creating booking:", response);
|
||||
throw new Error("Failed to create booking");
|
||||
}
|
||||
return response.data;
|
||||
|
||||
14
apps/hub/app/(app)/_querys/stations.ts
Normal file
14
apps/hub/app/(app)/_querys/stations.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user