- 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.
20 lines
702 B
TypeScript
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}`;
|
|
},
|
|
}; |