First
\r\nPrevious
\r\nNext
\r\n \r\nLast
\r\n\r\n {this.display}\r\n
\r\n );\r\n }\r\n}","import { AnyAction } from \"redux\";\r\nimport { FetchStatus, IFetchAction } from \"../middleware/fetch-middleware\";\r\nimport { IFacetDTO, ISearchResultDTO, ISearchResultHitDTO, ISearchCriteriaDTO } from \"../DTO/search\";\r\n\r\nimport * as _ from 'lodash';\r\n\r\nexport enum SearchApiActions {\r\n GetSearchResults = 'apiSearchResultsActions/getSearchResults'\r\n}\r\n\r\nexport interface SearchApiState {\r\n results: ISearchResultDTO\r\n}\r\n\r\nconst DefaultSearchApiState: SearchApiState = {\r\n results: Object.freeze({\r\n searchTerm: '',\r\n hits: [] as ISearchResultHitDTO[],\r\n facets: [] as IFacetDTO[],\r\n didYouMean: '',\r\n totalResults: 0\r\n } as ISearchResultDTO)\r\n}\r\n\r\n\r\nexport const searchApiReducer = (state = DefaultSearchApiState, action: AnyAction) => {\r\n switch (action.type) {\r\n case SearchApiActions.GetSearchResults + FetchStatus.Complete:\r\n return { ...state, results: action.data };\r\n\r\n default: return state;\r\n }\r\n}\r\n\r\nconst BaseUrl = '/api/v1/search';\r\nconst roleMatrix = sessionStorage?.getItem('rolesMatrix');\r\nexport const getSearchResults = (criteria: ISearchCriteriaDTO): IFetchAction => ({\r\n type: SearchApiActions.GetSearchResults,\r\n fetch: new Request(`${BaseUrl}/getResults?roleMatrix=${encodeURI(roleMatrix)}`, {\r\n method: 'POST',\r\n headers: new Headers({ 'Content-Type': 'application/json; charset=utf-8' }),\r\n body: JSON.stringify(criteria)\r\n })\r\n})\r\n\r\nconst autocompleteUrl = '/api/v1/search/autocomplete';\r\n\r\nexport const getAutocompleteResults = (searchTerm: string, size: number = 5) => {\r\n return window.fetch(`${autocompleteUrl}/${searchTerm}/${size}`)\r\n .then(function (response) {\r\n if (response.status === 504) {\r\n const errorMsg = new Error('Failed to fetch');\r\n errorMsg.message = 'Failed to fetch';\r\n throw errorMsg;\r\n } else if (response.status >= 400) {\r\n const errorMsg = new Error('Bad response');\r\n errorMsg.message = 'Bad response';\r\n throw errorMsg;\r\n }\r\n return response.json();\r\n }).then(data => data);\r\n}\r\n","import React, { useEffect } from 'react';\r\n\r\nexport function useOutsideClickAlerter(ref: React.RefObject{this.props.resultsPerPageText}
\r\n{this.props.epiProps?.loginModalMessage || 'You must login to view this content.'}
\r\n \r\n >\r\n