Last active
November 2, 2016 20:37
-
-
Save anthonybrown/5d5d067718161a4a757c55329714be46 to your computer and use it in GitHub Desktop.
Trying to display data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import axios from 'axios'; | |
import cookie from 'react-cookie'; | |
import { Modal,Button } from 'react-bootstrap' | |
import { API_URL, CLIENT_ROOT_URL, errorHandler } from '../../actions/index'; | |
class Professor extends Component { | |
constructor(props) { | |
super(props) | |
this.state = {} | |
} | |
componentDidMount () { | |
const authorization = "Bearer"+cookie.load('token').replace("JWT","") | |
axios.get(`${API_URL}/core/me`, { | |
headers: { 'Authorization': authorization } | |
}) | |
.then(response => { | |
this.setState({classrooms:response.data}) | |
}) | |
.catch((error) => { | |
console.log("error",error) | |
}) | |
} | |
render () { | |
return ( | |
<div className='container'> | |
<div className='jumbotron'> | |
<h1>Professor Page</h1> | |
<p>Welcome to the professor page.</p> | |
</div> | |
<div className='container'> | |
<div className='well'> | |
<pre>{JSON.stringify(this.state, null, ' ')}</pre> | |
</div> | |
</div> | |
</div> | |
) | |
} | |
} | |
export default Professor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment