1
+ 'use strict' ;
2
+
3
+ Object . defineProperty ( exports , "__esModule" , {
4
+ value : true
5
+ } ) ;
6
+
7
+ var _getPrototypeOf = require ( 'babel-runtime/core-js/object/get-prototype-of' ) ;
8
+
9
+ var _getPrototypeOf2 = _interopRequireDefault ( _getPrototypeOf ) ;
10
+
11
+ var _classCallCheck2 = require ( 'babel-runtime/helpers/classCallCheck' ) ;
12
+
13
+ var _classCallCheck3 = _interopRequireDefault ( _classCallCheck2 ) ;
14
+
15
+ var _createClass2 = require ( 'babel-runtime/helpers/createClass' ) ;
16
+
17
+ var _createClass3 = _interopRequireDefault ( _createClass2 ) ;
18
+
19
+ var _possibleConstructorReturn2 = require ( 'babel-runtime/helpers/possibleConstructorReturn' ) ;
20
+
21
+ var _possibleConstructorReturn3 = _interopRequireDefault ( _possibleConstructorReturn2 ) ;
22
+
23
+ var _inherits2 = require ( 'babel-runtime/helpers/inherits' ) ;
24
+
25
+ var _inherits3 = _interopRequireDefault ( _inherits2 ) ;
26
+
27
+ var _react = require ( 'react' ) ;
28
+
29
+ var _react2 = _interopRequireDefault ( _react ) ;
30
+
31
+ var _hoistNonReactStatics = require ( 'hoist-non-react-statics' ) ;
32
+
33
+ var _hoistNonReactStatics2 = _interopRequireDefault ( _hoistNonReactStatics ) ;
34
+
35
+ var _reactRedux = require ( 'react-redux' ) ;
36
+
37
+ function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
38
+
39
+ var fetchData = function fetchData ( ) {
40
+ return function ( WrappedComponent ) {
41
+ var Enhance = function ( _React$Component ) {
42
+ ( 0 , _inherits3 . default ) ( Enhance , _React$Component ) ;
43
+
44
+ function Enhance ( ) {
45
+ ( 0 , _classCallCheck3 . default ) ( this , Enhance ) ;
46
+ return ( 0 , _possibleConstructorReturn3 . default ) ( this , ( Enhance . __proto__ || ( 0 , _getPrototypeOf2 . default ) ( Enhance ) ) . apply ( this , arguments ) ) ;
47
+ }
48
+
49
+ ( 0 , _createClass3 . default ) ( Enhance , [ {
50
+ key : 'componentDidMount' ,
51
+ value : function componentDidMount ( ) {
52
+ if ( WrappedComponent . fetchData instanceof Function ) {
53
+ WrappedComponent . fetchData ( {
54
+ dispatch : this . props . dispatch ,
55
+ match : this . props . match
56
+ } ) ;
57
+ }
58
+ }
59
+ } , {
60
+ key : 'render' ,
61
+ value : function render ( ) {
62
+ return _react2 . default . createElement ( WrappedComponent , this . props ) ;
63
+ }
64
+ } ] ) ;
65
+ return Enhance ;
66
+ } ( _react2 . default . Component ) ;
67
+
68
+ return ( 0 , _reactRedux . connect ) ( ) ( ( 0 , _hoistNonReactStatics2 . default ) ( Enhance , WrappedComponent ) ) ;
69
+ } ;
70
+ } ;
71
+
72
+ exports . default = fetchData ;
0 commit comments