@@ -5,7 +5,7 @@ import TopCategoriesAndBrands from "./topCategoriesAndBrands";
55import { StyledSegment , StyledDimmer } from "../../../styles/semanticUI/customStyles" ;
66import { connect , useSelector } from "react-redux" ;
77import { DocumentTitle } from "../../ui/documentTitle" ;
8- import { getDataViaAPI } from "../../../actions" ;
8+ import { getDataViaAPI , setDefaultSearchSuggestions } from "../../../actions" ;
99import log from 'loglevel' ;
1010import { homePageDataReducer } from "../../../reducers/screens/commonScreenReducer" ;
1111import HomeMenuIcons from "./homeMenuIcons" ;
@@ -16,6 +16,8 @@ import {LOAD_HOME_PAGE} from "../../../actions/types";
1616import { BadRequest } from "../../ui/error/badRequest" ;
1717import { HOME_PAGE_DATA_API } from "../../../constants/api_routes" ;
1818import { HOME_PAGE_API_OBJECT_LEN } from "../../../constants/constants"
19+ import { authServiceAPI } from "../../../api/service_api" ;
20+ import axios from "axios" ;
1921
2022const Home = props => {
2123 const { hover} = useSelector ( state => state . tabHoverEventReducer )
@@ -25,6 +27,26 @@ const Home = props => {
2527 useEffect ( ( ) => {
2628 log . info ( "[Home]: component did mount." )
2729
30+ ///////////////////////////////////////////////////////////
31+ // Below requests are made just to wake up all services on
32+ // Heroku so that it serves the requests quickly.
33+ // This should be removed when the app is deployed on actual server.
34+ props . setDefaultSearchSuggestions ( )
35+ authServiceAPI . post ( '/authenticate' ) . catch ( err => { } )
36+ if ( process . env . REACT_APP_PAYMENT_SERVICE_URL ) {
37+ axios ( {
38+ method : 'post' ,
39+ url : `${ process . env . REACT_APP_PAYMENT_SERVICE_URL } /payment` ,
40+ headers : {
41+ 'Content-Type' : 'application/json' ,
42+ } ,
43+ data : "xyz"
44+ } ) . catch ( err => { } )
45+ }
46+ ///////////////////////////////////////////////////////////
47+
48+
49+
2850 if ( ! homeAPIData . hasOwnProperty ( "data" ) ) {
2951 props . getDataViaAPI ( LOAD_HOME_PAGE , HOME_PAGE_DATA_API , null , false ) ;
3052 }
@@ -75,4 +97,4 @@ const Home = props => {
7597 )
7698}
7799
78- export default connect ( null , { getDataViaAPI} ) ( Home ) ;
100+ export default connect ( null , { getDataViaAPI, setDefaultSearchSuggestions } ) ( Home ) ;
0 commit comments