mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 20:05:41 +00:00
28 lines
933 B
TypeScript
28 lines
933 B
TypeScript
import type { Freight, PaginatedResponse } from "@edr/types";
|
|
|
|
import { client } from "../utils/api";
|
|
|
|
export type CreateBookingPayload = Freight.CreateBookingDto;
|
|
|
|
export const bookingsService = {
|
|
list: async (): Promise<PaginatedResponse<Freight.IBooking>> => {
|
|
const { data } = await client.get("/bookings");
|
|
return data.data;
|
|
},
|
|
get: async (id: string): Promise<Freight.IBooking> => {
|
|
const { data } = await client.get(`/bookings/${id}`);
|
|
return data.data;
|
|
},
|
|
create: async (payload: CreateBookingPayload): Promise<Freight.IBooking> => {
|
|
const { data } = await client.post("/api/bookings", payload);
|
|
return data.data;
|
|
},
|
|
getReferenceData: async (): Promise<Freight.BookingReferenceData> => {
|
|
const { data } = await client.get("/api/bookings/reference-data");
|
|
return data.data;
|
|
},
|
|
remove: async (id: string): Promise<void> => {
|
|
await client.delete(`/bookings/${id}`);
|
|
},
|
|
};
|