diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-16 14:03:04 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-16 14:03:04 +0200 |
| commit | 3504248ae4db51380413c45699e4453efb314561 (patch) | |
| tree | 07a4e906ae37e0967c3ecb1b53732537badcda0a /app/client/dashboard/dashboard.actions.js | |
| parent | 8955da42bd3b66543ecea80f00ec979a6140f5bc (diff) | |
load folders into dashboard...
Diffstat (limited to 'app/client/dashboard/dashboard.actions.js')
| -rw-r--r-- | app/client/dashboard/dashboard.actions.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/client/dashboard/dashboard.actions.js b/app/client/dashboard/dashboard.actions.js index 01c0a96..319c164 100644 --- a/app/client/dashboard/dashboard.actions.js +++ b/app/client/dashboard/dashboard.actions.js @@ -1 +1,31 @@ import types from '../types' +import actions from '../actions' +import util from '../util' + +export const load = () => (dispatch) => { + util.allProgress([ + actions.task.index(), + actions.folder.index(), + ], (percent, i, n) => { + console.log('dashboard load progress', i, n) + dispatch({ type: types.app.load_progress, progress: { i, n }}) + }).then(res => { + const [ tasks, folders ] = res + const { mapFn, sortFn } = util.sort.orderByFn('date desc') + const foldersByModule = folders.map(mapFn).sort(sortFn).reduce((a,b) => { + const module = b[1].module + a[module] = a[module] || [] + a[module].push(b[1]) + return a + }, {}) + dispatch({ + type: types.dashboard.load, + data: { + tasks, + folders, + foldersByModule, + }, + }) + + }) +}
\ No newline at end of file |
