carnet panel contact
This commit is contained in:
parent
da9094e92d
commit
ffa842d140
@ -144,12 +144,19 @@ export default function CarnetPage() {
|
|||||||
// For contacts, parse the VCF files
|
// For contacts, parse the VCF files
|
||||||
const parsedContacts = await Promise.all(
|
const parsedContacts = await Promise.all(
|
||||||
data.map(async (file: any) => {
|
data.map(async (file: any) => {
|
||||||
const contentResponse = await fetch(`/api/nextcloud/files/content?id=${file.filename}`);
|
try {
|
||||||
|
// Use the full filename for fetching content
|
||||||
|
const contentResponse = await fetch(`/api/nextcloud/files/content?path=${encodeURIComponent(file.filename)}`);
|
||||||
if (contentResponse.ok) {
|
if (contentResponse.ok) {
|
||||||
const content = await contentResponse.text();
|
const content = await contentResponse.text();
|
||||||
return parseVCard(content);
|
return parseVCard(content);
|
||||||
}
|
}
|
||||||
|
console.error('Failed to fetch VCF content:', contentResponse.status);
|
||||||
return null;
|
return null;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching VCF content:', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
setContacts(parsedContacts.filter(Boolean));
|
setContacts(parsedContacts.filter(Boolean));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user