diff options
| author | adamhrv <adam@ahprojects.com> | 2018-12-15 19:57:49 +0100 |
|---|---|---|
| committer | adamhrv <adam@ahprojects.com> | 2018-12-15 19:57:49 +0100 |
| commit | 82b2c0b5d6d7baccbe4d574d96e18fe2078047d7 (patch) | |
| tree | a8784b7ec2bc5a0451c252f66a6b786f3a2504f5 /scraper/client/common/gate.component.js | |
| parent | 8e978af21c2b29f678a09701afb3ec7d65d0a6ab (diff) | |
| parent | c5b02ffab8d388e8a2925e51736b902a48a95e71 (diff) | |
Merge branch 'master' of github.com:adamhrv/megapixels_dev
Diffstat (limited to 'scraper/client/common/gate.component.js')
| -rw-r--r-- | scraper/client/common/gate.component.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scraper/client/common/gate.component.js b/scraper/client/common/gate.component.js new file mode 100644 index 00000000..9bf9287b --- /dev/null +++ b/scraper/client/common/gate.component.js @@ -0,0 +1,21 @@ +import React from 'react' +import { connect } from 'react-redux' + +function Gate(props) { + const { app, tag, View } = props + const data = app[tag] + if (!data) return null + if (data === 'loading') { + return <div className='tableObject loading'>{tag}{': Loading'}</div> + } + if (data.err) { + return <div className='tableObject error'>{tag}{' Error: '}{data.err}</div> + } + return <View data={data} {...props} /> +} + +const mapStateToProps = state => ({ + app: state.metadata +}) + +export default connect(mapStateToProps)(Gate) |
