/** * * Store for hub * * * @author Björn Hase * */ import observable from '@riotjs/observable' import notificationStore from '@tiny-components/notification/src/notificationStore.js' export default observable( { /** * getting all hubs, * trigger update after response * * * @param {object} data * */ get(id, path) { let url = '/api/files/v1/' + id if (path && path.length > 0) { url += '?' + new URLSearchParams({ 'path': path.join('/') }) } fetch(url) .then((response) => response.json()) .then((response) => { this.trigger('update', response.data) }) .catch(() => { notificationStore.danger('Error! Connection Problem!') }) } })