Pages corrections
This commit is contained in:
parent
e55bcb8b78
commit
d78e26914d
@ -141,14 +141,18 @@ export default function CarnetPage() {
|
|||||||
}, [isSmallScreen, isMediumScreen]);
|
}, [isSmallScreen, isMediumScreen]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log(`[useEffect] selectedFolder changed to: "${selectedFolder}"`);
|
||||||
if (selectedFolder === 'Contacts') {
|
if (selectedFolder === 'Contacts') {
|
||||||
// When "Contacts" is selected, show all contacts
|
// When "Contacts" is selected, show all contacts
|
||||||
|
console.log(`[useEffect] Calling fetchContacts('Contacts')`);
|
||||||
fetchContacts('Contacts');
|
fetchContacts('Contacts');
|
||||||
} else if (selectedFolder.endsWith('.vcf')) {
|
} else if (selectedFolder.endsWith('.vcf')) {
|
||||||
// When a specific VCF file is selected, show its contacts
|
// When a specific VCF file is selected, show its contacts
|
||||||
|
console.log(`[useEffect] Calling fetchContacts('${selectedFolder}')`);
|
||||||
fetchContacts(selectedFolder);
|
fetchContacts(selectedFolder);
|
||||||
} else {
|
} else {
|
||||||
// For other folders (Notes, etc.), fetch notes
|
// For other folders (Notes, etc.), fetch notes
|
||||||
|
console.log(`[useEffect] Calling fetchNotes() for folder: ${selectedFolder}`);
|
||||||
fetchNotes();
|
fetchNotes();
|
||||||
}
|
}
|
||||||
}, [selectedFolder, session?.user?.id]);
|
}, [selectedFolder, session?.user?.id]);
|
||||||
@ -214,11 +218,13 @@ export default function CarnetPage() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchContacts = async (folder: string) => {
|
const fetchContacts = async (folder: string) => {
|
||||||
|
console.log(`[fetchContacts] Called with folder: ${folder}`);
|
||||||
try {
|
try {
|
||||||
setIsLoadingContacts(true);
|
setIsLoadingContacts(true);
|
||||||
|
|
||||||
// Use lowercase for consistency
|
// Use lowercase for consistency
|
||||||
const folderLowercase = folder.toLowerCase();
|
const folderLowercase = folder.toLowerCase();
|
||||||
|
console.log(`[fetchContacts] Processing folder: ${folderLowercase}`);
|
||||||
|
|
||||||
// First, check if we're looking at a specific VCF file
|
// First, check if we're looking at a specific VCF file
|
||||||
if (folder.endsWith('.vcf')) {
|
if (folder.endsWith('.vcf')) {
|
||||||
@ -233,7 +239,9 @@ export default function CarnetPage() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If not a VCF file, list all VCF files in the folder
|
// If not a VCF file, list all VCF files in the folder
|
||||||
|
console.log(`[fetchContacts] Fetching files from API for folder: ${folderLowercase}`);
|
||||||
const response = await fetch(`/api/storage/files?folder=${folderLowercase}`);
|
const response = await fetch(`/api/storage/files?folder=${folderLowercase}`);
|
||||||
|
console.log(`[fetchContacts] API response status: ${response.status}`);
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const files = await response.json();
|
const files = await response.json();
|
||||||
console.log(`[fetchContacts] Found ${files.length} files in contacts folder`, files);
|
console.log(`[fetchContacts] Found ${files.length} files in contacts folder`, files);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user