All checks were successful
Deploy KCG / deploy (push) Successful in 1m10s
Co-authored-by: htlee <htlee@gcsc.co.kr> Co-committed-by: htlee <htlee@gcsc.co.kr>
27 lines
673 B
TypeScript
27 lines
673 B
TypeScript
const API_BASE = '/api/kcg';
|
|
|
|
export interface CollectorInfo {
|
|
name: string;
|
|
region: string;
|
|
lastSuccess: string;
|
|
lastFailure: string;
|
|
lastCount: number;
|
|
lastError: string;
|
|
totalSuccess: number;
|
|
totalFailure: number;
|
|
totalItems: number;
|
|
}
|
|
|
|
interface CollectorStatusResponse {
|
|
collectors: CollectorInfo[];
|
|
serverTime: string;
|
|
}
|
|
|
|
export async function fetchCollectorStatus(): Promise<CollectorStatusResponse> {
|
|
const res = await fetch(`${API_BASE}/admin/collector-status`, {
|
|
headers: { Accept: 'application/json' },
|
|
});
|
|
if (!res.ok) throw new Error(`collector-status ${res.status}`);
|
|
return res.json() as Promise<CollectorStatusResponse>;
|
|
}
|