async fetch() {
        let items = await HashBrown.Service.MediaService.getAllMedia() || [];
        
        this.state.folders = [];

        for(let item of items) {
            if(!item.folder || item.folder === '/' || this.state.folders.indexOf(item.folder) > -1) { continue; }

            this.state.folders.push(item.folder);
        }

        this.state.items = [];

        if(this.state.name === 'searching') {
            let query = (this.state.searchQuery || '').toLowerCase();

            for(let item of items) {
                if(query && (item.name || '').toLowerCase().indexOf(query) < 0) { continue; }

                this.state.items.push(item);
            }

        } else if(this.state.name === undefined) {
            for(let item of items) {
                if(!item.folder) { item.folder = '/'; }

                if(this.state.folder !== item.folder) { continue; }

                this.state.items.push(item);
            }
        }
    }
/**
     * Fetches all media and caches folder paths
     */
Fetches all media and caches folder paths
Fetches all media and caches folder paths
async fetch() {
        let items = await HashBrown.Service.MediaService.getAllMedia() || [];
        this.state.folders = [];
        for(let item of items) {
            if(!item.folder || item.folder === '/' || this.state.folders.indexOf(item.folder) > -1) { continue; }
            this.state.folders.push(item.folder);
        }
        this.state.items = [];
        if(this.state.name === 'searching') {
            let query = (this.state.searchQuery || '').toLowerCase();
            for(let item of items) {
                if(query && (item.name || '').toLowerCase().indexOf(query) < 0) { continue; }
                this.state.items.push(item);
            }
        } else if(this.state.name === undefined) {
            for(let item of items) {
                if(!item.folder) { item.folder = '/'; }
                if(this.state.folder !== item.folder) { continue; }
                this.state.items.push(item);
            }
        }
    }
async fetch ( ) { let items = await HashBrown . Service . MediaService . getAllMedia ( ) || [ ] ; this . state . folders = [ ] ; for ( let item of items ) { if ( ! item . folder || item . folder === '/' || this . state . folders . indexOf ( item . folder ) > - 1 ) { continue ; } this . state . folders . push ( item . folder ) ; } this . state . items = [ ] ; if ( this . state . name === 'searching' ) { let query = ( this . state . searchQuery || '' ) . toLowerCase ( ) ; for ( let item of items ) { if ( query && ( item . name || '' ) . toLowerCase ( ) . indexOf ( query ) < 0 ) { continue ; } this . state . items . push ( item ) ; } } else if ( this . state . name === undefined ) { for ( let item of items ) { if ( ! item . folder ) { item . folder = '/' ; } if ( this . state . folder !== item . folder ) { continue ; } this . state . items . push ( item ) ; } } }
Fetches all media and caches folder paths
Fetches all media and caches folder paths