import { Dispatch } from 'redux' ; import { ActionType , Folder } from '../RendererTypes' ; import { FileItem } from '../../common/Types' ; returns export const requestEnumSubFolders = ( ) => ( { type : ActionType . RequestEnumSubFolders as ActionType . RequestEnumSubFolders } ) ; param items returns export const finishEnumSubFolders = ( folderPath , subFolders ) => ( { type : ActionType . FinishEnumSubFolders as ActionType . FinishEnumSubFolders , payload : { folderPath , subFolders } } ) ; param folderPath export const enumSubFolders = ( folderPath ) => async ( dispatch ) => { dispatch ( requestEnumSubFolders ( ) ) ; const items = await window . myAPI . enumItems ( folderPath ) ; const folders = items . filter ( ( item ) => item . isDirectory ) . map ( ( item ) : Folder => ( { treeId : 0 , isRoot : false , name : item . name , path : item . path , subFolders : [ ] } ) ) ; dispatch ( finishEnumSubFolders ( folderPath , folders ) ) ; } ;