- Timestamp:
- 09/21/22 18:47:39 (2 years ago)
- Branches:
- master
- Children:
- 34950c6
- Parents:
- 5201690
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
phonelux-frontend/src/components/PhoneCardGridComponent/PhoneCardGridComponent.js
r5201690 rd66b8eb 6 6 import './PhoneCardGridComponent.css' 7 7 import phoneImage from '../../images/phone.png' 8 import SortByComponent from '../FiltersComponents/SortByComponent' 8 9 9 10 export class PhoneCardGridComponent extends Component { … … 20 21 } 21 22 23 } 24 25 26 getQueryString = () => { 27 let filters = '?' 28 if(localStorage.getItem('shops')) 29 { 30 filters += 'shops='+localStorage.getItem('shops')+'&' 31 } 32 if(localStorage.getItem('brands')) 33 { 34 filters += 'brands='+localStorage.getItem('brands')+'&' 35 } 36 if(localStorage.getItem('priceRange')) 37 { 38 filters += 'priceRange='+localStorage.getItem('priceRange')+'&' 39 } 40 41 if(localStorage.getItem('sortBy')) 42 { 43 filters += 'sortBy='+localStorage.getItem('sortBy')+'&' 44 } 45 46 // dodaj filtri za specifikacija i sredi go sortBy 47 48 return filters 22 49 } 23 50 … … 46 73 { 47 74 filters += 'sortBy='+this.props.sortBy+'&' 48 } 75 } 76 77 // dodaj gi i filtrite za specifikacija 78 79 // izdvoj metod da ti pravi querystring 49 80 50 81 axios.get('/phones'+filters) … … 62 93 63 94 componentDidMount() { 64 axios.get('/phones' )95 axios.get('/phones'+this.getQueryString()) 65 96 .then(response => { 66 97 this.setState({
Note:
See TracChangeset
for help on using the changeset viewer.