UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

14 lines (12 loc) 630 B
import { includes } from 'lodash' import { Observable } from 'rxjs' import { Store } from 'redux' import { RX_HTTP_ERROR, RxHttpGlobalErrorAction } from 'redux-rx-http' import { logout, LOGOUT, redirect } from '@lml/cosmo-ui-auth' import { combineEpics, ActionsObservable } from 'redux-observable' import { AppState } from '../../root/reducers' export const deauthEpic = (action$: ActionsObservable<any>, store: Store<AppState>): Observable<any> => action$.ofType(RX_HTTP_ERROR) .filter((action: RxHttpGlobalErrorAction) => includes([401, 403], action.error.response.status)) .mapTo(logout())