New booking dashboard
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import axios, { AxiosError } from 'axios'
|
||||
import type {
|
||||
AdminBooking,
|
||||
CreateAdminBookingInput,
|
||||
Court,
|
||||
CreateCourtInput,
|
||||
CreatePublicBookingInput,
|
||||
@@ -20,6 +22,7 @@ import type {
|
||||
PublicBooking,
|
||||
PublicBookingConfirmation,
|
||||
Sport,
|
||||
UpdateAdminBookingStatusInput,
|
||||
UpdateCourtInput,
|
||||
UpdateComplexPayload,
|
||||
UpdateComplexResponse,
|
||||
@@ -261,6 +264,39 @@ export const apiClient = {
|
||||
return response.data
|
||||
},
|
||||
},
|
||||
adminBookings: {
|
||||
listByComplex: async (
|
||||
complexId: string,
|
||||
params: {
|
||||
fromDate: string
|
||||
},
|
||||
) => {
|
||||
const response = await http.get<{ bookings: AdminBooking[] }>(
|
||||
`/api/admin-bookings/complex/${complexId}`,
|
||||
{
|
||||
params,
|
||||
},
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
create: async (complexId: string, payload: CreateAdminBookingInput) => {
|
||||
const response = await http.post<AdminBooking>(
|
||||
`/api/admin-bookings/complex/${complexId}`,
|
||||
payload,
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
updateStatus: async (
|
||||
bookingId: string,
|
||||
payload: UpdateAdminBookingStatusInput,
|
||||
) => {
|
||||
const response = await http.patch<AdminBooking>(
|
||||
`/api/admin-bookings/${bookingId}/status`,
|
||||
payload,
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export type ApiClient = typeof apiClient
|
||||
|
||||
Reference in New Issue
Block a user