Last change
on this file since dbd4834 was dbd4834, checked in by Marko <Marko@…>, 2 years ago |
Homepage, login and register components added
|
-
Property mode
set to
100644
|
File size:
874 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 | this.setState({
|
---|
21 | phone: response.data
|
---|
22 | })
|
---|
23 | }).catch(error => console.log(error))
|
---|
24 | }
|
---|
25 |
|
---|
26 | render() {
|
---|
27 | return (
|
---|
28 | <>
|
---|
29 | <HeaderComponent/>
|
---|
30 | <PhoneWithOffersComponent phoneId={this.state.phoneId} {...this.state.phone}/>
|
---|
31 | </>
|
---|
32 | )
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | export default PhonePageComponent
|
---|
Note:
See
TracBrowser
for help on using the repository browser.