carnet panel contact
This commit is contained in:
parent
6cef226948
commit
add7e45af9
@ -164,7 +164,9 @@ export default function CarnetPage() {
|
||||
|
||||
const parseVCard = (content: string): Contact[] => {
|
||||
try {
|
||||
// Split the content into individual vCards
|
||||
const vcards = content.split('BEGIN:VCARD').filter(section => section.trim());
|
||||
|
||||
return vcards.map(section => {
|
||||
const vcard = new VCard();
|
||||
vcard.parse('BEGIN:VCARD' + section);
|
||||
@ -179,7 +181,8 @@ export default function CarnetPage() {
|
||||
const notes = vcard.getProperty('NOTE')?.value;
|
||||
const group = vcard.getProperty('CATEGORIES')?.value;
|
||||
|
||||
return {
|
||||
// Create a clean contact object
|
||||
const contact: Contact = {
|
||||
id: uid || Math.random().toString(36).substr(2, 9),
|
||||
fullName: fullName || 'Unknown Contact',
|
||||
email: email || '',
|
||||
@ -189,6 +192,8 @@ export default function CarnetPage() {
|
||||
notes: notes || '',
|
||||
group: group || ''
|
||||
};
|
||||
|
||||
return contact;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error parsing VCF content:', error);
|
||||
@ -199,6 +204,7 @@ export default function CarnetPage() {
|
||||
const fetchContacts = async (folder: string) => {
|
||||
try {
|
||||
setIsLoadingContacts(true);
|
||||
|
||||
// First, check if we're looking at a specific VCF file
|
||||
if (folder.endsWith('.vcf')) {
|
||||
const response = await fetch(`/api/nextcloud/files/content?path=${encodeURIComponent(`/files/cube-${session?.user?.id}/Private/Contacts/${folder}`)}`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user