接入前端真实接口并标记邮件HTML清洗
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
reservationTaskAudits,
|
||||
reservationTaskDetails,
|
||||
} from '@/fixtures/reservation'
|
||||
import { reservationHotelId } from '@/config/reservationConfig'
|
||||
import { getJson, sendJson } from '@/services/httpClient'
|
||||
import type {
|
||||
ReservationOperaOperationResult,
|
||||
@@ -20,29 +21,22 @@ import type {
|
||||
|
||||
const useReservationFixtures = import.meta.env.VITE_RESERVATION_USE_FIXTURES === 'true'
|
||||
|
||||
export class EndpointPendingError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message)
|
||||
this.name = 'EndpointPendingError'
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchReservationOrders(
|
||||
filters: ReservationOrderListFilters = {},
|
||||
): Promise<ReservationOrderListResult> {
|
||||
void filters
|
||||
throw new EndpointPendingError('GET /api/reservation/orders is pending backend implementation.')
|
||||
return getJson<ReservationOrderListResult>(withQuery('/api/reservation/orders', withReservationHotel(filters)))
|
||||
}
|
||||
|
||||
export async function fetchReservationTaskList(
|
||||
filters: ReservationTaskListFilters = {},
|
||||
): Promise<ReservationTaskListResult> {
|
||||
return getJson<ReservationTaskListResult>(withQuery('/api/reservation/tasks', filters))
|
||||
return getJson<ReservationTaskListResult>(withQuery('/api/reservation/tasks', withReservationHotel(filters)))
|
||||
}
|
||||
|
||||
export async function fetchReservationOrderDetail(orderId: string): Promise<ReservationOrderDetailResult> {
|
||||
return getJson<ReservationOrderDetailResult>(
|
||||
withQuery(`/api/reservation/orders/${encodeURIComponent(orderId)}`, {
|
||||
hotel_id: reservationHotelId,
|
||||
include_tasks: true,
|
||||
include_source_summary: true,
|
||||
}),
|
||||
@@ -52,8 +46,8 @@ export async function fetchReservationOrderDetail(orderId: string): Promise<Rese
|
||||
export async function fetchSourceMessageConversation(
|
||||
sourceMessageId: string,
|
||||
): Promise<SourceMessageConversationResult> {
|
||||
throw new EndpointPendingError(
|
||||
`GET /api/source-messages/${sourceMessageId}/conversation is pending backend implementation.`,
|
||||
return getJson<SourceMessageConversationResult>(
|
||||
`/api/source-messages/${encodeURIComponent(sourceMessageId)}/conversation`,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -143,6 +137,13 @@ function withQuery(path: string, params: object): string {
|
||||
return query ? `${path}?${query}` : path
|
||||
}
|
||||
|
||||
function withReservationHotel<T extends { hotel_id?: string }>(filters: T): T {
|
||||
return {
|
||||
hotel_id: reservationHotelId,
|
||||
...filters,
|
||||
}
|
||||
}
|
||||
|
||||
function fixtureTaskDetail(taskId: string): Promise<ReservationTaskDetailResult> {
|
||||
const detail = reservationTaskDetails.find((item) => item.task_id === taskId)
|
||||
if (!detail) {
|
||||
|
||||
Reference in New Issue
Block a user