Last change
on this file since d66b8eb was d66b8eb, checked in by Marko <Marko@…>, 2 years ago |
Component for editing offers added
|
-
Property mode
set to
100644
|
File size:
911 bytes
|
Line | |
---|
1 | import axios from 'axios'
|
---|
2 | import React, { Component } from 'react'
|
---|
3 | import HeaderComponent from './HeaderComponent/HeaderComponent'
|
---|
4 | import PhoneWithOffersComponent from './PhoneWithOffersComponent/PhoneWithOffersComponent'
|
---|
5 |
|
---|
6 | export class PhonePageComponent extends Component {
|
---|
7 |
|
---|
8 | constructor(props) {
|
---|
9 | super(props)
|
---|
10 |
|
---|
11 | this.state = {
|
---|
12 | phoneId: window.location.href.split('/')[4],
|
---|
13 | phone: null
|
---|
14 | }
|
---|
15 | }
|
---|
16 |
|
---|
17 | componentDidMount(){
|
---|
18 | axios.get('/phones/'+this.state.phoneId)
|
---|
19 | .then(response => {
|
---|
20 | console.log(response.data)
|
---|
21 | this.setState({
|
---|
22 | phone: response.data
|
---|
23 | })
|
---|
24 | }).catch(error => console.log(error))
|
---|
25 | }
|
---|
26 |
|
---|
27 | render() {
|
---|
28 | return (
|
---|
29 | <>
|
---|
30 | <HeaderComponent/>
|
---|
31 | <PhoneWithOffersComponent phoneId={this.state.phoneId} {...this.state.phone}/>
|
---|
32 | </>
|
---|
33 | )
|
---|
34 | }
|
---|
35 | }
|
---|
36 |
|
---|
37 | export default PhonePageComponent
|
---|
Note:
See
TracBrowser
for help on using the repository browser.