carnet route
This commit is contained in:
parent
6b01c856e7
commit
00a4f4d299
@ -268,8 +268,9 @@ async function getFolderStructure(nextcloudUrl: string, username: string, passwo
|
||||
}
|
||||
|
||||
const folderData = await foldersResponse.text();
|
||||
console.log('Received folder data:', folderData);
|
||||
|
||||
console.log('Folder data:', folderData);
|
||||
|
||||
// Parse the XML response to get folder names
|
||||
const parser = new DOMParser();
|
||||
const xmlDoc = parser.parseFromString(folderData, 'text/xml');
|
||||
const responses = Array.from(xmlDoc.getElementsByTagName('d:response'));
|
||||
@ -282,7 +283,9 @@ async function getFolderStructure(nextcloudUrl: string, username: string, passwo
|
||||
if (isCollection) {
|
||||
const href = response.getElementsByTagName('d:href')[0]?.textContent;
|
||||
if (href) {
|
||||
const folderName = href.split('/').pop();
|
||||
// Extract folder name from href
|
||||
const parts = href.split('/').filter(Boolean);
|
||||
const folderName = decodeURIComponent(parts[parts.length - 1]);
|
||||
if (folderName && folderName !== 'Private') {
|
||||
folders.push(folderName);
|
||||
}
|
||||
@ -290,7 +293,7 @@ async function getFolderStructure(nextcloudUrl: string, username: string, passwo
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Extracted folders:', folders);
|
||||
console.log('Parsed folders:', folders);
|
||||
return folders;
|
||||
} catch (error) {
|
||||
console.error('Error getting folder structure:', error);
|
||||
|
||||
@ -138,6 +138,12 @@ export default function CarnetPage() {
|
||||
console.log('Saving note:', note);
|
||||
};
|
||||
|
||||
const handleFolderSelect = (folder: string) => {
|
||||
console.log('Selected folder:', folder);
|
||||
// TODO: Implement folder selection logic
|
||||
setLayoutMode(PaneLayout.ItemSelection);
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex h-screen items-center justify-center">
|
||||
@ -159,7 +165,7 @@ export default function CarnetPage() {
|
||||
layout={layoutMode}
|
||||
onLayoutChange={setLayoutMode}
|
||||
nextcloudFolders={nextcloudFolders}
|
||||
onFolderSelect={() => {}}
|
||||
onFolderSelect={handleFolderSelect}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user