carnet panel contact

This commit is contained in:
alma 2025-04-20 20:36:59 +02:00
parent 543c78f7d5
commit faf54f1fec

View File

@ -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)}`);