You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
631 B
13 lines
631 B
import values from 'lodash/values'
|
|
import { AppState, APIRequest } from '../types'
|
|
|
|
const REQUEST_LOADING_MIN = 500
|
|
|
|
export const getMenuCollapsed = (state: AppState) => state.menu.collapsed
|
|
export const getAuthenticated = (state: AppState) => state.authentication.authenticated
|
|
export const getNotifications = (state: AppState) => state.notifications
|
|
|
|
export const getFetching = (state: AppState) => {
|
|
const isFetching = (request: APIRequest) => request.fetching && (Date.now() - request.started > REQUEST_LOADING_MIN)
|
|
return values(state.requests).reduce((fetching, request) => fetching || isFetching(request) , false)
|
|
}
|