build fix
This commit is contained in:
parent
a7f64bdabd
commit
43ab63a195
@ -592,8 +592,8 @@ export default function CarnetPage() {
|
|||||||
const { content } = await response.json();
|
const { content } = await response.json();
|
||||||
// Split the content into individual vCards
|
// Split the content into individual vCards
|
||||||
existingContacts = content.split('BEGIN:VCARD')
|
existingContacts = content.split('BEGIN:VCARD')
|
||||||
.filter(section => section.trim())
|
.filter((section: string) => section.trim())
|
||||||
.map(section => 'BEGIN:VCARD' + section.trim());
|
.map((section: string) => 'BEGIN:VCARD' + section.trim());
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If the file doesn't exist, we'll create it with just the new contact
|
// If the file doesn't exist, we'll create it with just the new contact
|
||||||
@ -703,14 +703,14 @@ export default function CarnetPage() {
|
|||||||
const { content } = await response.json();
|
const { content } = await response.json();
|
||||||
|
|
||||||
// Split the content into individual vCards and filter out the one to delete
|
// Split the content into individual vCards and filter out the one to delete
|
||||||
const vcards = content.split('BEGIN:VCARD').filter(section => section.trim());
|
const vcards = content.split('BEGIN:VCARD').filter((section: string) => section.trim());
|
||||||
const updatedVcards = vcards.filter(section => {
|
const updatedVcards = vcards.filter((section: string) => {
|
||||||
const vcard = parseVCard('BEGIN:VCARD' + section);
|
const vcard = parseVCard('BEGIN:VCARD' + section);
|
||||||
return vcard.uid?.[0]?.value !== contact.id;
|
return vcard.uid?.[0]?.value !== contact.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Join the remaining vCards back together
|
// Join the remaining vCards back together
|
||||||
const vcfContent = updatedVcards.map(section => 'BEGIN:VCARD' + section).join('\n');
|
const vcfContent = updatedVcards.map((section: string) => 'BEGIN:VCARD' + section).join('\n');
|
||||||
|
|
||||||
// Save the updated VCF file
|
// Save the updated VCF file
|
||||||
const saveResponse = await fetch('/api/nextcloud/files', {
|
const saveResponse = await fetch('/api/nextcloud/files', {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user