30 lines
954 B
TypeScript
30 lines
954 B
TypeScript
export const breadcrumbMap: Record<string, string> = {
|
|
'dashboard': 'Dashboard',
|
|
'settings': 'Settings',
|
|
'demo': 'Demo',
|
|
'users': 'User Management',
|
|
'customers': 'Kundenübersicht',
|
|
'projects': 'Projekte',
|
|
};
|
|
|
|
export const breadcrumbResolvers: Record<string, (id: string) => Promise<string>> = {
|
|
"customers": async (id: string) => {
|
|
try {
|
|
const response = await fetch(`/api/customers/${id}`);
|
|
if (!response.ok) {
|
|
return `ID: ${id}`;
|
|
}
|
|
|
|
const customer = await response.json();
|
|
if (!customer) return `ID: ${id}`;
|
|
|
|
if (customer.companyName) return `Firma: ${customer.companyName}`;
|
|
if (customer.name) return `Name: ${customer.name}`;
|
|
return `ID: ${id}`;
|
|
} catch (error) {
|
|
console.error('Error fetching customer for breadcrumb:', error);
|
|
return `ID: ${id}`;
|
|
}
|
|
},
|
|
};
|