Add dialogs and update API for cancel requests
This commit is contained in:
@@ -8,7 +8,6 @@ import type {
|
||||
RideType,
|
||||
RideStatus,
|
||||
CancelRequestType,
|
||||
CancelRequestStatus,
|
||||
LoadingSheetStatus,
|
||||
DeliveryTaskStatus,
|
||||
} from '@/types/api'
|
||||
@@ -38,10 +37,6 @@ export interface CancelRequestBody {
|
||||
reason: string
|
||||
}
|
||||
|
||||
export interface CancelRequestReviewBody {
|
||||
status: CancelRequestStatus
|
||||
}
|
||||
|
||||
export const rides = {
|
||||
list: (params?: RideListParams) =>
|
||||
api.get<PaginatedResponse<RideResponse>>('/rides', { params }).then(r => r.data),
|
||||
@@ -52,6 +47,9 @@ export const rides = {
|
||||
create: (body: RideBody) =>
|
||||
api.post<RideResponse>('/rides', body).then(r => r.data),
|
||||
|
||||
assignDriver: (id: string, driverProfileId: string) =>
|
||||
api.put<RideResponse>(`/rides/${id}/driver`, { driverProfileId }).then(r => r.data),
|
||||
|
||||
activate: (id: string) =>
|
||||
api.patch<RideResponse>(`/rides/${id}/activate`).then(r => r.data),
|
||||
|
||||
@@ -59,14 +57,17 @@ export const rides = {
|
||||
api.patch<RideResponse>(`/rides/${id}/close`, { meterend }).then(r => r.data),
|
||||
|
||||
cancelRequests: {
|
||||
list: (rideId: string) =>
|
||||
api.get<CancelRequestResponse[]>(`/rides/${rideId}/cancel-requests`).then(r => r.data),
|
||||
getForRide: (rideId: string) =>
|
||||
api.get<CancelRequestResponse | null>(`/rides/${rideId}/cancel-request`).then(r => r.data),
|
||||
|
||||
create: (rideId: string, body: CancelRequestBody) =>
|
||||
api.post<CancelRequestResponse>(`/rides/${rideId}/cancel-requests`, body).then(r => r.data),
|
||||
raise: (rideId: string, body: CancelRequestBody) =>
|
||||
api.post<CancelRequestResponse>(`/rides/${rideId}/cancel-request`, body).then(r => r.data),
|
||||
|
||||
review: (rideId: string, requestId: string, body: CancelRequestReviewBody) =>
|
||||
api.patch<CancelRequestResponse>(`/rides/${rideId}/cancel-requests/${requestId}`, body).then(r => r.data),
|
||||
approve: (requestId: string) =>
|
||||
api.post<CancelRequestResponse>(`/rides/cancel-requests/${requestId}/approve`).then(r => r.data),
|
||||
|
||||
reject: (requestId: string) =>
|
||||
api.post<CancelRequestResponse>(`/rides/cancel-requests/${requestId}/reject`).then(r => r.data),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user