@@ -5,12 +5,13 @@ import CloseIcon from '@material-ui/icons/Close';
5
5
import ArrowBackIcon from '@material-ui/icons/ArrowBack' ;
6
6
import { Grid } from "@material-ui/core" ;
7
7
import log from 'loglevel' ;
8
- import { connect , useDispatch , useSelector } from "react-redux" ;
8
+ import { connect , useSelector } from "react-redux" ;
9
9
import { getSearchSuggestions , getDataViaAPI } from "../../../actions" ;
10
10
import { makeStyles } from "@material-ui/core/styles" ;
11
- import { SAVE_QUERY_STATUS } from "../../../actions/types" ;
11
+ import { LOAD_FILTER_PRODUCTS } from "../../../actions/types" ;
12
12
import { Loader } from "semantic-ui-react" ;
13
13
import { StyledSearchBarDimmer } from "../../../styles/semanticUI/customStyles" ;
14
+ import { PRODUCT_BY_CATEGORY_DATA_API } from "../../../constants/api_routes" ;
14
15
15
16
export const useSearchBarStyles = makeStyles ( ( theme ) => ( {
16
17
paper : {
@@ -32,7 +33,6 @@ function SearchBar(props) {
32
33
const filterProductsReducer = useSelector ( state => state . filterProductsReducer )
33
34
const classes = useSearchBarStyles ( )
34
35
const [ isLoading , setIsLoading ] = useState ( false )
35
- const dispatch = useDispatch ( )
36
36
let selectedValue = null
37
37
38
38
useEffect ( ( ) => {
@@ -62,10 +62,8 @@ function SearchBar(props) {
62
62
log . info ( `queryLink = ${ queryLink } , value = ${ value } ` )
63
63
if ( queryLink ) {
64
64
setIsLoading ( true )
65
- dispatch ( {
66
- type : SAVE_QUERY_STATUS ,
67
- payload : `?q=${ queryLink } `
68
- } )
65
+ props . getDataViaAPI ( LOAD_FILTER_PRODUCTS ,
66
+ `${ PRODUCT_BY_CATEGORY_DATA_API } ?q=${ queryLink } ` )
69
67
}
70
68
}
71
69
}
0 commit comments