From faf54f1fec93d6e58b1318cd49c3ce45eab96867 Mon Sep 17 00:00:00 2001 From: alma Date: Sun, 20 Apr 2025 20:36:59 +0200 Subject: [PATCH] carnet panel contact --- app/carnet/page.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/carnet/page.tsx b/app/carnet/page.tsx index 03c81db0..ea29586e 100644 --- a/app/carnet/page.tsx +++ b/app/carnet/page.tsx @@ -438,9 +438,13 @@ export default function CarnetPage() { try { setIsLoading(true); - const path = `/files/cube-${session?.user?.id}/Private/Contacts/${selectedFolder}`; - // Get all contacts from the current VCF file + // Determine the correct path based on whether we're in the Contacts folder or a specific VCF file + const basePath = `/files/cube-${session?.user?.id}/Private/Contacts`; + const vcfFile = contact.group ? `${contact.group}.vcf` : selectedFolder; + const path = `${basePath}/${vcfFile}`; + + // Get all contacts from the VCF file const response = await fetch(`/api/nextcloud/files/content?path=${encodeURIComponent(path)}`); if (!response.ok) { throw new Error('Failed to fetch contacts'); @@ -487,7 +491,10 @@ export default function CarnetPage() { setIsLoading(true); if (!selectedFolder) return; - const path = `/files/cube-${session?.user?.id}/Private/Contacts/${selectedFolder}`; + // Determine the correct path based on whether we're in the Contacts folder or a specific VCF file + const basePath = `/files/cube-${session?.user?.id}/Private/Contacts`; + const vcfFile = contact.group ? `${contact.group}.vcf` : selectedFolder; + const path = `${basePath}/${vcfFile}`; // Get existing contacts from the VCF file const response = await fetch(`/api/nextcloud/files/content?path=${encodeURIComponent(path)}`);