Ignore:
Timestamp:
09/21/22 18:47:39 (22 months ago)
Author:
Marko <Marko@…>
Branches:
master
Children:
34950c6
Parents:
5201690
Message:

Component for editing offers added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • phonelux-frontend/src/components/PhoneCardGridComponent/PhoneCardGridComponent.js

    r5201690 rd66b8eb  
    66import './PhoneCardGridComponent.css'
    77import phoneImage from '../../images/phone.png'
     8import SortByComponent from '../FiltersComponents/SortByComponent'
    89
    910export class PhoneCardGridComponent extends Component {
     
    2021    }
    2122
     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
    2249  }
    2350
     
    4673      {
    4774        filters += 'sortBy='+this.props.sortBy+'&'
    48       }
     75      }
     76
     77      // dodaj gi i filtrite za specifikacija
     78
     79      // izdvoj metod da ti pravi querystring
    4980
    5081      axios.get('/phones'+filters)
     
    6293
    6394  componentDidMount() {
    64     axios.get('/phones')
     95    axios.get('/phones'+this.getQueryString())
    6596      .then(response => {
    6697        this.setState({
Note: See TracChangeset for help on using the changeset viewer.