git ssb

2+

mixmix / ticktack



Tree: 00f38454d156756289d50eaf84d0c5b276f702b3

Files: 00f38454d156756289d50eaf84d0c5b276f702b3 / router / sync / routes.js

632 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 } = api.app.page
15
16 // route format: [ routeValidator, routeFunction ]
17 const routes = [
18 [ ({ page }) => page === 'home', home ],
19 [ ({ type }) => type === 'group', group ],
20 [ ({ key }) => !isEmpty(key), private ],
21 ]
22
23 return [...routes, ...sofar]
24 })
25}
26

Built with git-ssb-web