* fix(logs): Remove console.log's * chore(challengeMap): challengeMap -> completedChallenges * chore(userModel): Update user model * feat(userIDs): Add user ident fields * chore(github): Remove more refs to github data
		
			
				
	
	
		
			39 lines
		
	
	
		
			832 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			832 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { ofType } from 'redux-epic';
 | |
| import debug from 'debug';
 | |
| 
 | |
| import {
 | |
|   types as appTypes,
 | |
|   createErrorObservable
 | |
| } from '../../redux';
 | |
| import { types, fetchMapUiComplete } from './';
 | |
| import { shapeChallenges } from '../../redux/utils';
 | |
| 
 | |
| const isDev = debug.enabled('fcc:*');
 | |
| 
 | |
| export default function fetchMapUiEpic(
 | |
|   actions,
 | |
|   _,
 | |
|   { services }
 | |
| ) {
 | |
|   return actions::ofType(
 | |
|     appTypes.appMounted,
 | |
|     types.fetchMapUi.start
 | |
|   )
 | |
|     .flatMapLatest(() => {
 | |
|       const options = {
 | |
|         service: 'map-ui'
 | |
|       };
 | |
|       return services.readService$(options)
 | |
|         .retry(3)
 | |
|         .map(({ entities, ...res }) => ({
 | |
|           entities: shapeChallenges(
 | |
|             entities,
 | |
|             isDev
 | |
|           ),
 | |
|           ...res
 | |
|         }))
 | |
|         .map(fetchMapUiComplete)
 | |
|         .catch(createErrorObservable);
 | |
|     });
 | |
|   }
 |