import _ from 'lodash' ; import { createSelector } from 'reselect' ; import { ApplicationState } from 'store/reducers' ; param state return const getUserState = ( state ) => state . user ; param state return export const getIsLoggedIn = createSelector ( [ getUserState ] , ( user ) => ! _ . isNil ( user . tokens ) ) ; param state return export const getIsMod = createSelector ( [ getUserState ] , ( user ) => user . isMod ) ; param state return export const getChatLoginDetails = createSelector ( [ getUserState ] , ( user ) => { if ( _ . isNil ( user . tokens ) || _ . isNil ( user . username ) ) { return null ; } return { password : `oauth:${ user . tokens . access }` , username : user . username , } ; } ) ; param state return export const getLoginDetails = createSelector ( [ getUserState ] , ( user ) => { if ( _ . isNil ( user . tokens ) || _ . isNil ( user . username ) ) { return null ; } return { id : user . tokens . id . sub , password : user . tokens . access , username : user . username , } ; } ) ;