import { loadUserInfo } from '@app/redux/actions/user' ; import { loadTopicList } from '@app/redux/actions/topic' ; export default ( store , accessToken ? ) => { return new Promise < Array < any > > ( async ( resolve ) => { await loadTopicList ( { id : 'parent-topics' , args : { parent_id : "not-exists" , sort_by : 'sort:-1' , recommend : true } } ) ( store . dispatch , store . getState ) ; try { if ( accessToken ) { let res = await loadUserInfo ( { accessToken } ) ( store . dispatch , store . getState ) ; resolve ( res ) ; } else { resolve ( [ ] ) ; } } catch ( err ) { console . log ( err ) ; resolve ( [ ] ) ; } } ) ; } ;