Files
rheinsw-mono-repo/internal_frontend/lib/navigation/breadcrumb-map.ts
Thatsaphorn Atchariyaphap 328c0537ba Introduce caching in CustomerRepository and refactor API integration
- Add in-memory caching for customer data in `CustomerRepository` to reduce API calls.
- Replace direct API calls with methods from `CustomerRepository`.
- Update customer-related pages (`[id]/page.tsx`, `customers/page.tsx`) to use `CustomerRepository` for data fetching.
- Adjust breadcrumb resolver to leverage `CustomerRepository`.
- Remove `axios` dependency from customer-related components.
2025-07-07 22:02:55 +02:00

20 lines
702 B
TypeScript

import {CustomerRepository} from "@/services/customers/repositories/customerRepository";
export const breadcrumbMap: Record<string, string> = {
'dashboard': 'Dashboard',
'settings': 'Settings',
'demo': 'Demo',
'users': 'User Management',
'customers': 'Kundenübersicht',
};
export const breadcrumbResolvers: Record<string, (id: string) => Promise<string>> = {
"customers": async (id: string) => {
const customer = await CustomerRepository.getById(id);
if (!customer) return `ID: ${id}`;
if (customer.companyName) return `Firma: ${customer.companyName}`;
if (customer.name) return `Name: ${customer.name}`;
return `ID: ${id}`;
},
};