- Add FielUploadModal component for FIEL credential upload - Add SyncStatus component showing current sync progress - Add SyncHistory component with pagination and retry - Add SAT configuration page at /configuracion/sat - Add API client functions for FIEL and SAT endpoints Features: - File upload with Base64 encoding - Real-time sync progress tracking - Manual sync trigger (initial/daily) - Sync history with retry capability - FIEL status display with expiration warning Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import { apiClient } from './client';
|
|
import type {
|
|
SatSyncJob,
|
|
SatSyncStatusResponse,
|
|
SatSyncHistoryResponse,
|
|
StartSyncRequest,
|
|
StartSyncResponse,
|
|
} from '@horux/shared';
|
|
|
|
export async function startSync(data?: StartSyncRequest): Promise<StartSyncResponse> {
|
|
const response = await apiClient.post<StartSyncResponse>('/sat/sync', data || {});
|
|
return response.data;
|
|
}
|
|
|
|
export async function getSyncStatus(): Promise<SatSyncStatusResponse> {
|
|
const response = await apiClient.get<SatSyncStatusResponse>('/sat/sync/status');
|
|
return response.data;
|
|
}
|
|
|
|
export async function getSyncHistory(page: number = 1, limit: number = 10): Promise<SatSyncHistoryResponse> {
|
|
const response = await apiClient.get<SatSyncHistoryResponse>('/sat/sync/history', {
|
|
params: { page, limit },
|
|
});
|
|
return response.data;
|
|
}
|
|
|
|
export async function getSyncJob(id: string): Promise<SatSyncJob> {
|
|
const response = await apiClient.get<SatSyncJob>(`/sat/sync/${id}`);
|
|
return response.data;
|
|
}
|
|
|
|
export async function retrySync(id: string): Promise<StartSyncResponse> {
|
|
const response = await apiClient.post<StartSyncResponse>(`/sat/sync/${id}/retry`);
|
|
return response.data;
|
|
}
|
|
|
|
export async function getCronInfo(): Promise<{ scheduled: boolean; expression: string; timezone: string }> {
|
|
const response = await apiClient.get('/sat/cron');
|
|
return response.data;
|
|
}
|
|
|
|
export async function runCron(): Promise<{ message: string }> {
|
|
const response = await apiClient.post('/sat/cron/run');
|
|
return response.data;
|
|
}
|