// import { AnyAction } from 'redux'
// import { ActionsObservable, combineEpics, ofType } from 'redux-observable'
// import { from, of } from 'rxjs'
// import { catchError, switchMap } from 'rxjs/operators'

// import { mapSystemApiToStore } from '@agiliza/api/mappers/system'
// import { session } from '@agiliza/api/useCases'
// import { actions, types } from '@agiliza/redux/ui/system'
// import { getError } from '@agiliza/utils/method'

// type FetchMenuAction = ReturnType<typeof actions.fetchMenu>

// const fetchMenuEpic = (action$: ActionsObservable<AnyAction>) =>
//   action$.pipe(
//     ofType<AnyAction, FetchMenuAction>(types.fetchMenu),
//     switchMap(() =>
//       from(session.fetchMenu()).pipe(
//         switchMap((menu) => of(actions.fetchMenuSuccess(mapSystemApiToStore(menu)))),
//         catchError((error) => of(actions.fetchMenuError(getError(error))))
//       )
//     )
//   )

// export default combineEpics(fetchMenuEpic)
