carnet panel contact

This commit is contained in:
alma 2025-04-20 19:17:29 +02:00
parent da9094e92d
commit ffa842d140

View File

@ -144,12 +144,19 @@ export default function CarnetPage() {
// For contacts, parse the VCF files
const parsedContacts = await Promise.all(
data.map(async (file: any) => {
const contentResponse = await fetch(`/api/nextcloud/files/content?id=${file.filename}`);
if (contentResponse.ok) {
const content = await contentResponse.text();
return parseVCard(content);
try {
// Use the full filename for fetching content
const contentResponse = await fetch(`/api/nextcloud/files/content?path=${encodeURIComponent(file.filename)}`);
if (contentResponse.ok) {
const content = await contentResponse.text();
return parseVCard(content);
}
console.error('Failed to fetch VCF content:', contentResponse.status);
return null;
} catch (error) {
console.error('Error fetching VCF content:', error);
return null;
}
return null;
})
);
setContacts(parsedContacts.filter(Boolean));