diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-07-19 00:50:05 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-07-19 00:50:05 +0200 |
| commit | 64e8c03dea044752bf3f2f228462721fe565f950 (patch) | |
| tree | 41b48b67f69979bfc97be166129ee41c8dcb0c7f /client/index.jsx | |
| parent | 11a70bc347587219b2ec7b63cf4a6ff69bb4199b (diff) | |
refactor all the worker stuff
Diffstat (limited to 'client/index.jsx')
| -rw-r--r-- | client/index.jsx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/client/index.jsx b/client/index.jsx index b0815f4..1a8577e 100644 --- a/client/index.jsx +++ b/client/index.jsx @@ -2,8 +2,30 @@ import { h, render } from 'preact' import { Provider } from 'react-redux' import App from './components/App.jsx' import store from './store' +import client from './client' import socket from './socket' +import { loadFolders, loadOpenFolders, loadFiles, loadTasks } from './actions/index.js' + +client.folder.index().then( folders => { + store.dispatch(loadFolders(folders)) + try { + const openFolders = JSON.parse(localStorage['openFolders']) + store.dispatch( loadOpenFolders(openFolders) ) + openFolders.forEach( folder_id => { + client.file.index({ folder_id }).then( files => { + store.dispatch(loadFiles(files)) + }) + }) + } + catch (e) { + console.log('error opening folders') + } +}) +client.task.index().then( tasks => { + store.dispatch(loadTasks(tasks)) +}) + const app = ( <Provider store={store}> <App /> |
