lml-main
Version:
This is now a mono repository published into many standalone packages.
19 lines (16 loc) • 738 B
text/typescript
import * as Pusher from 'pusher-js'
import { Observable } from 'rxjs'
import { combineEpics, ActionsObservable } from 'redux-observable'
import { Store } from 'redux'
import { AUTHENTICATED } from '@lml/cosmo-ui-auth'
import { AppState } from '../../root/reducers'
import { PusherConnectAction, pusherConnect, cosmoPusherEpics } from '@lml/cosmo-redux-pusher'
import { config } from '../../config'
export const connectToPusherOnLogIn =
(action$: ActionsObservable<any>, store: Store<any>): Observable<PusherConnectAction> =>
action$.ofType(AUTHENTICATED)
.mapTo(pusherConnect(config.PUSHER_KEY, config.PUSHER_CLUSTER))
export const pusherEpics = combineEpics(
cosmoPusherEpics,
connectToPusherOnLogIn,
)