更新 API 路由,添加获取所有代理、心跳、锁和会议的端点;修改会议队列和前端请求处理;新增前端完整测试脚本。
This commit is contained in:
@@ -19,7 +19,19 @@ async function request<T>(
|
||||
endpoint: string,
|
||||
options?: RequestInit
|
||||
): Promise<T> {
|
||||
const url = `${API_BASE}${endpoint}`;
|
||||
// 自动添加末尾斜杠避免 307 重定向
|
||||
let normalizedEndpoint = endpoint;
|
||||
if (endpoint.includes('?')) {
|
||||
// 带查询参数:在 ? 之前添加斜杠
|
||||
const [path, query] = endpoint.split('?');
|
||||
if (!path.endsWith('/')) {
|
||||
normalizedEndpoint = `${path}/?${query}`;
|
||||
}
|
||||
} else if (!endpoint.match(/\/[^/]+$/)) {
|
||||
// 不带查询参数且不以路径结尾:添加斜杠
|
||||
normalizedEndpoint = `${endpoint}/`;
|
||||
}
|
||||
const url = `${API_BASE}${normalizedEndpoint}`;
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user