git ssb

2+

mixmix / ticktack



Tree: 119e5a731640d722b01b4aa15a4ec30a09b17285

Files: 119e5a731640d722b01b4aa15a4ec30a09b17285 / router / sync / routes.js

670 bytesRaw
1const nest = require('depnest')
2const isEmpty = require('lodash/isEmpty')
3
4exports.gives = nest('router.sync.routes')
5
6exports.needs = nest({
7 'app.page.home': 'first',
8 'app.page.group': 'first',
9 'app.page.private': 'first'
10})
11
12exports.create = (api) => {
13 return nest('router.sync.routes', (sofar = []) => {
14 const { home, group, private: privatePage } = api.app.page
15
16 // route format: [ routeValidator, routeFunction ]
17 const routes = [
18 [ location => location.page === 'home', home ],
19 [ location => location.type === 'group', group ],
20 [ location => !isEmpty(location.key), privatePage ]
21 ]
22
23 return [...routes, ...sofar]
24 })
25}
26

Built with git-ssb-web