Add new frontend - fix 16
This commit is contained in:
@@ -42,7 +42,7 @@ export class DataService {
|
||||
additionalData?: Record<string, any>
|
||||
): Promise<UploadResponse> {
|
||||
const response = await apiClient.upload<ApiResponse<UploadResponse>>(
|
||||
'/data/upload-sales',
|
||||
'/api/v1/data/upload-sales',
|
||||
file,
|
||||
additionalData
|
||||
);
|
||||
@@ -54,7 +54,7 @@ export class DataService {
|
||||
*/
|
||||
async validateSalesData(file: File): Promise<DataValidation> {
|
||||
const response = await apiClient.upload<ApiResponse<DataValidation>>(
|
||||
'/data/validate-sales',
|
||||
'/api/v1/data/validate-sales',
|
||||
file
|
||||
);
|
||||
return response.data!;
|
||||
@@ -65,7 +65,7 @@ export class DataService {
|
||||
*/
|
||||
async getDashboardStats(): Promise<DashboardStats> {
|
||||
const response = await apiClient.get<ApiResponse<DashboardStats>>(
|
||||
'/data/dashboard/stats'
|
||||
'/api/v1/data/dashboard/stats'
|
||||
);
|
||||
return response.data!;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ export class DataService {
|
||||
total: number;
|
||||
page: number;
|
||||
pages: number;
|
||||
}>>('/data/sales', { params });
|
||||
}>>('/api/v1/data/sales', { params });
|
||||
return response.data!;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ export class DataService {
|
||||
*/
|
||||
async createSalesRecord(record: CreateSalesRequest): Promise<SalesRecord> {
|
||||
const response = await apiClient.post<ApiResponse<SalesRecord>>(
|
||||
'/data/sales',
|
||||
'/api/v1/data/sales',
|
||||
record
|
||||
);
|
||||
return response.data!;
|
||||
@@ -108,7 +108,7 @@ export class DataService {
|
||||
updates: Partial<CreateSalesRequest>
|
||||
): Promise<SalesRecord> {
|
||||
const response = await apiClient.put<ApiResponse<SalesRecord>>(
|
||||
`/data/sales/${id}`,
|
||||
`/api/v1/data/sales/${id}`,
|
||||
updates
|
||||
);
|
||||
return response.data!;
|
||||
@@ -118,7 +118,7 @@ export class DataService {
|
||||
* Delete sales record
|
||||
*/
|
||||
async deleteSalesRecord(id: string): Promise<void> {
|
||||
await apiClient.delete(`/data/sales/${id}`);
|
||||
await apiClient.delete(`/api/v1/data/sales/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +130,7 @@ export class DataService {
|
||||
location?: string;
|
||||
}): Promise<WeatherData[]> {
|
||||
const response = await apiClient.get<ApiResponse<WeatherData[]>>(
|
||||
'/data/weather',
|
||||
'/api/v1/data/weather',
|
||||
{ params }
|
||||
);
|
||||
return response.data!;
|
||||
@@ -145,7 +145,7 @@ export class DataService {
|
||||
location?: string;
|
||||
}): Promise<TrafficData[]> {
|
||||
const response = await apiClient.get<ApiResponse<TrafficData[]>>(
|
||||
'/data/traffic',
|
||||
'/api/v1/data/traffic',
|
||||
{ params }
|
||||
);
|
||||
return response.data!;
|
||||
@@ -159,7 +159,7 @@ export class DataService {
|
||||
weatherData: { completeness: number; quality: number; lastUpdate: string };
|
||||
trafficData: { completeness: number; quality: number; lastUpdate: string };
|
||||
}> {
|
||||
const response = await apiClient.get<ApiResponse<any>>('/data/quality');
|
||||
const response = await apiClient.get<ApiResponse<any>>('/api/v1/data/quality');
|
||||
return response.data!;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ export class DataService {
|
||||
endDate?: string;
|
||||
format?: 'csv' | 'excel';
|
||||
}): Promise<Blob> {
|
||||
const response = await apiClient.get('/data/sales/export', {
|
||||
const response = await apiClient.get('/api/v1/data/sales/export', {
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
@@ -182,7 +182,7 @@ export class DataService {
|
||||
* Get product list
|
||||
*/
|
||||
async getProducts(): Promise<string[]> {
|
||||
const response = await apiClient.get<ApiResponse<string[]>>('/data/products');
|
||||
const response = await apiClient.get<ApiResponse<string[]>>('/api/v1/data/products');
|
||||
return response.data!;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ export class DataService {
|
||||
weather: { lastSync: string; status: 'ok' | 'error'; nextSync: string };
|
||||
traffic: { lastSync: string; status: 'ok' | 'error'; nextSync: string };
|
||||
}> {
|
||||
const response = await apiClient.get<ApiResponse<any>>('/data/sync/status');
|
||||
const response = await apiClient.get<ApiResponse<any>>('/api/v1/data/sync/status');
|
||||
return response.data!;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ export class DataService {
|
||||
* Trigger manual data sync
|
||||
*/
|
||||
async triggerSync(dataType: 'weather' | 'traffic' | 'all'): Promise<void> {
|
||||
await apiClient.post('/data/sync/trigger', { data_type: dataType });
|
||||
await apiClient.post('/api/v1/data/sync/trigger', { data_type: dataType });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user