|
| 1 | +// import R from 'ramda' |
| 2 | + |
| 3 | +import { makeDebugger, $solver, asyncErr, ERR } from '../../utils' |
| 4 | +import SR71 from '../../utils/network/sr71' |
| 5 | + |
| 6 | +// import S from './schema' |
| 7 | + |
| 8 | +const sr71$ = new SR71() |
| 9 | +let sub$ = null |
| 10 | + |
| 11 | +/* eslint-disable no-unused-vars */ |
| 12 | +const debug = makeDebugger('L:RepoBanner') |
| 13 | +/* eslint-enable no-unused-vars */ |
| 14 | + |
| 15 | +let store = null |
| 16 | + |
| 17 | +export function someMethod() {} |
| 18 | + |
| 19 | +// ############################### |
| 20 | +// Data & Error handlers |
| 21 | +// ############################### |
| 22 | + |
| 23 | +const DataSolver = [] |
| 24 | +const ErrSolver = [ |
| 25 | + { |
| 26 | + match: asyncErr(ERR.CRAPHQL), |
| 27 | + action: ({ details }) => { |
| 28 | + debug('ERR.CRAPHQL -->', details) |
| 29 | + }, |
| 30 | + }, |
| 31 | + { |
| 32 | + match: asyncErr(ERR.TIMEOUT), |
| 33 | + action: ({ details }) => { |
| 34 | + debug('ERR.TIMEOUT -->', details) |
| 35 | + }, |
| 36 | + }, |
| 37 | + { |
| 38 | + match: asyncErr(ERR.NETWORK), |
| 39 | + action: ({ details }) => { |
| 40 | + debug('ERR.NETWORK -->', details) |
| 41 | + }, |
| 42 | + }, |
| 43 | +] |
| 44 | + |
| 45 | +export function init(_store) { |
| 46 | + if (store) return false |
| 47 | + store = _store |
| 48 | + |
| 49 | + debug(store) |
| 50 | + if (sub$) sub$.unsubscribe() |
| 51 | + sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver)) |
| 52 | +} |
0 commit comments