frontend refactor

This commit is contained in:
Egor Pozharov
2026-04-14 17:10:13 +06:00
parent 0540218332
commit 9b90a8aa7f
14 changed files with 328 additions and 127 deletions

View File

@@ -1,4 +1,5 @@
import { api } from './client';
import { backendDateToFrontend } from '../utils/date';
import type { Delivery, PickupLocation, DeliveryStatus } from '../types';
// Types matching backend responses
@@ -44,18 +45,6 @@ interface UpdateDeliveryResponse {
message: string;
}
// Convert backend date format (YYYY-MM-DD) to frontend format (DD-MM-YYYY)
function backendDateToFrontend(dateStr: string): string {
const [year, month, day] = dateStr.split('-');
return `${day}-${month}-${year}`;
}
// Convert frontend date format (DD-MM-YYYY) to backend format (YYYY-MM-DD)
export function frontendDateToBackend(dateStr: string): string {
const [day, month, year] = dateStr.split('-');
return `${year}-${month}-${day}`;
}
// Map backend delivery to frontend delivery
function mapBackendToFrontend(backend: BackendDelivery): Delivery {
return {