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/HomepageComponent.js

    r5201690 rd66b8eb  
    1616    priceRange: '',
    1717    searchValue: '',
    18     sortBy: 'mostPopular'
     18    sortBy: 'mostPopular',
     19    ram: '',
     20    rom: '',
     21    frontcamera: '',
     22    backcamera: '',
     23    chipset: '',
     24    cpu: '',
     25    operatingsystem: '',
     26    color: '',
     27    battery: ''
    1928  }
    2029}
     
    5766    })
    5867  }
     68
     69  if(e.hasOwnProperty('ram'))
     70  {
     71    this.setState({
     72      ram: e.ram
     73    })
     74
     75  }
     76 
     77  if(e.hasOwnProperty('rom'))
     78  {
     79    this.setState({
     80      rom: e.rom
     81    })
     82  }
     83
     84  if(e.hasOwnProperty('frontcamera'))
     85  {
     86    this.setState({
     87      frontcamera: e.frontcamera
     88    })
     89  }
     90
     91  if(e.hasOwnProperty('backcamera'))
     92  {
     93    this.setState({
     94      backcamera: e.backcamera
     95    })
     96
     97  }
     98 
     99  if(e.hasOwnProperty('chipset'))
     100  {
     101    this.setState({
     102      chipset: e.chipset
     103    })
     104  }
     105
     106  if(e.hasOwnProperty('cpu'))
     107  {
     108    this.setState({
     109      cpu: e.cpu
     110    })
     111
     112  }
     113 
     114  if(e.hasOwnProperty('operatingsystem'))
     115  {
     116    this.setState({
     117      operatingsystem: e.operatingsystem
     118    })
     119  }
     120
     121  if(e.hasOwnProperty('color'))
     122  {
     123    this.setState({
     124      color: e.color
     125    })
     126
     127  }
     128 
     129  if(e.hasOwnProperty('battery'))
     130  {
     131    this.setState({
     132      battery: e.battery
     133    })
     134  }
     135}
     136
     137componentDidMount(){
     138  if(localStorage.getItem('brands'))
     139  {
     140    this.setState({
     141      brands: localStorage.getItem('brands')
     142    })
     143  }
     144  if(localStorage.getItem('shops'))
     145  {
     146    this.setState({
     147      shops: localStorage.getItem('shops')
     148    })
     149  }
     150  if(localStorage.getItem('priceRange'))
     151  {
     152    this.setState({
     153      priceRange: localStorage.getItem('priceRange')
     154    })
     155  }
     156 
     157  if(localStorage.getItem('sortBy'))
     158  {
     159    this.setState({
     160      sortBy: localStorage.getItem('sortBy')
     161    })
     162  }
     163  if(localStorage.getItem('ram'))
     164  {
     165    this.setState({
     166      ram: localStorage.getItem('ram')
     167    })
     168  }
     169  if(localStorage.getItem('rom'))
     170  {
     171    this.setState({
     172      rom: localStorage.getItem('rom')
     173    })
     174  }
     175  if(localStorage.getItem('frontcamera'))
     176  {
     177    this.setState({
     178      frontcamera: localStorage.getItem('frontcamera')
     179    })
     180  }
     181  if(localStorage.getItem('backcamera'))
     182  {
     183    this.setState({
     184      backcamera: localStorage.getItem('backcamera')
     185    })
     186  }
     187  if(localStorage.getItem('chipset'))
     188  {
     189    this.setState({
     190      chipset: localStorage.getItem('chipset')
     191    })
     192  }
     193  if(localStorage.getItem('cpu'))
     194  {
     195    this.setState({
     196      cpu: localStorage.getItem('cpu')
     197    })
     198  }
     199  if(localStorage.getItem('operatingsystem'))
     200  {
     201    this.setState({
     202      operatingsystem: localStorage.getItem('operatingsystem')
     203    })
     204  }
     205  if(localStorage.getItem('color'))
     206  {
     207    this.setState({
     208      color: localStorage.getItem('color')
     209    })
     210  }
     211  if(localStorage.getItem('battery'))
     212  {
     213    this.setState({
     214      battery: localStorage.getItem('battery')
     215    })
     216  }
     217  console.log(this.state)
    59218}
    60219
    61220
    62221  render() {
    63     console.log(this.context)
    64     console.log(localStorage.getItem('token'))
     222    // console.log(this.context)
     223    // console.log(localStorage.getItem('token'))
     224    console.log(this.state)
    65225    return (
    66226        <>
Note: See TracChangeset for help on using the changeset viewer.