Why does my array only print my folders and not my subfolders inside?

Viewed 34

i´m calling some many folders from my api and that folders have subfolders my problem is my code only print the folders and not the subfolders too

Folders:

Folders
├─┬folderOne
  ├── subFolderOne
├─┬ FolderTwo
  ├── subFolderTwo

my code

//api Request

const Folders = await axios.get(`${Dogos.url}/nodes/Folders/children`, PARAMS);

//array
const typesR = Folders.data.list.entries.map((type) =>{
  return {id: type.entry.id, name: type.entry.name};
});

console.log(typesR);

console show me only folderOne and FolderTwo not subFolders

[
  {
    id: '3434243-4343-480a-43-4342234',
    name: 'FolderOne',
  },
  {
    id: '313213-332323-32331-a895-323132',
    name: 'FolderTwo',
  }
]

i need to do something like this

[
  {
    id: '3434243-4343-480a-43-4342234',
    name: 'FolderOne',
  },
  {
    id: '343a4222243-4343-480a-43-4342234',
    name: 'subFolderOne',
  },
  {
    id: '313213-323-3231-a895-32312',
    name: 'FolderTwo',
  },
  {
    id: '34ss34243-4343-480a-43-4342234',
    name: 'subFolderTwo',
  },
]
0 Answers
Related