feat: stabilize document type and upload flows
This commit is contained in:
+12
-2
@@ -4,6 +4,12 @@
|
||||
import axios from 'axios';
|
||||
import { API_BASE_URL } from '../config/api-config';
|
||||
|
||||
interface ApiResult<T> {
|
||||
code: number;
|
||||
message: string;
|
||||
data: T | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 队列状态响应接口
|
||||
*/
|
||||
@@ -43,12 +49,16 @@ export async function getQueueStatus(): Promise<{ data?: QueueStatus; error?: st
|
||||
headers['Authorization'] = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
const response = await axios.get<QueueStatus>(
|
||||
const response = await axios.get<ApiResult<QueueStatus>>(
|
||||
`${API_BASE_URL}/api/v2/system/queue/status`,
|
||||
{ headers }
|
||||
);
|
||||
|
||||
return { data: response.data };
|
||||
if (response.data?.data) {
|
||||
return { data: response.data.data };
|
||||
}
|
||||
|
||||
return { error: response.data?.message || '队列状态响应格式错误' };
|
||||
} catch (error) {
|
||||
// 队列接口暂未迁移,404 时返回空状态不报错
|
||||
if (axios.isAxiosError(error) && error.response?.status === 404) {
|
||||
|
||||
Reference in New Issue
Block a user