feat(device): 实现设备创建功能并优化API调用
- 添加设备创建接口,支持认证检查和重定向 - 更新设备服务以使用新的请求体类型 - 修改表单组件以支持设备创建请求和响应处理 - 扩展HTTP客户端和类型定义以支持对象类型的请求体 - 添加调试日志记录API响应信息 - 更新按钮点击事件处理函数以触发设备创建流程
This commit is contained in:
@@ -6,7 +6,7 @@ import { log } from '$lib/log.ts';
|
||||
|
||||
|
||||
interface RequestOptions extends Omit<RequestInit, 'method' | 'body'> {
|
||||
body?: JsonObject | FormData;
|
||||
body?: JsonObject | FormData | object;
|
||||
}
|
||||
const API_BASE_URL = import.meta.env.VITE_PUBLIC_API_URL || 'http://localhost:18888/api';
|
||||
|
||||
@@ -92,6 +92,7 @@ const httpRequest = async <T>(
|
||||
body: canHaveBody ? requestBody : undefined,
|
||||
...rest
|
||||
});
|
||||
log.debug('API Response:', response)
|
||||
if (!response.ok) {
|
||||
|
||||
let errorDetail;
|
||||
|
||||
Reference in New Issue
Block a user