summaryrefslogtreecommitdiff
path: root/scraper/client/types.js
blob: e3c64691e7782334356b7bb39c2303b0036f7226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
export const asType = (type, name) => [type, name].join('_').toUpperCase()
export const tagAsType = (type, names) => (
  names.reduce((tags, name) => {
    tags[name] = asType(type, name)
    return tags
  }, {})
)

export const metadata = tagAsType('metadata', [
  'loading', 'loaded', 'loaded_many', 'error', 'set_hash'
])

export const search = tagAsType('search', [
  'loading', 'loaded', 'error', 'panic', 'update_options',
])

export const review = tagAsType('review', [
  'loading', 'loaded', 'error', 'save', 'unsave', 'refresh', 'clear', 'dedupe', 'create', 'set_count'
])

export const init = '@@INIT'