frontend refactor
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user