Skip to content

Commit

Permalink
Merge pull request #77 from microlinkhq/server-side
Browse files Browse the repository at this point in the history
Fix server side support
  • Loading branch information
Kikobeats authored Feb 25, 2018
2 parents 30c997a + 65bb8e1 commit a071fd7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/react-microlink/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ import {CardWrap, CardMedia, CardContent, CardEmptyState} from './components/Car
import {getUrlPath, someProp, createApiUrl} from './utils'

class Microlink extends Component {
componentWillMount () {
constructor () {
super()
this.state = {
loading: true
}
}

componentDidMount () {
if (this.props.data) return this.setData({data: this.props.data})
const promise = this.fetchData()
return this.setState({loading: true}, () => promise.then(this.setData))
return this.fetchData().then(this.setData)
}

fetchData = () => {
Expand Down

0 comments on commit a071fd7

Please sign in to comment.