55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
/*
|
|
Copyright (C) 2025 QuantumNous
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as
|
|
published by the Free Software Foundation, either version 3 of the
|
|
License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
*/
|
|
|
|
import { requestWebsite } from '../../helpers/websiteApi';
|
|
|
|
export async function fetchDemoReservations({
|
|
name = '',
|
|
contact = '',
|
|
companyName = '',
|
|
page = 1,
|
|
pageSize = 10,
|
|
} = {}) {
|
|
const params = new URLSearchParams({
|
|
name: name.trim(),
|
|
contact: contact.trim(),
|
|
companyName: companyName.trim(),
|
|
p: String(page),
|
|
page_size: String(pageSize),
|
|
});
|
|
const data = await requestWebsite(
|
|
'get',
|
|
`/api/website/demo-requests?${params}`,
|
|
undefined,
|
|
'预约信息加载失败,请重新查询',
|
|
);
|
|
if (
|
|
!data ||
|
|
!Array.isArray(data.items) ||
|
|
!Number.isInteger(data.total) ||
|
|
data.total < 0 ||
|
|
!Number.isInteger(data.page) ||
|
|
data.page < 1 ||
|
|
!Number.isInteger(data.page_size) ||
|
|
data.page_size < 1
|
|
)
|
|
throw new Error('预约列表响应格式不正确,请联系管理员检查');
|
|
return data;
|
|
}
|