import { loadTips } from './tips' ; import { loadSessionList } from './session' ; import { getUserInfo } from '../reducers/user' ; export const loadBadge = function ( ) { return ( dispatch , getState ) => { return new Promise ( async ( resolve ) => { const me = getUserInfo ( getState ( ) ) ; if ( ! me ) { resolve ( ) ; return ; } await loadTips ( ) ( dispatch , getState ) ; dispatch ( { type : 'CLEAN_SESSION' } ) ; dispatch ( { type : 'CLEAN_MESSAGE' } ) ; loadSessionList ( { id : 'all' , args : { } , restart : true } ) ( dispatch , getState ) ; resolve ( ) ; } ) ; } ; } ;