@@ -10,7 +10,7 @@ import DishDetail from './DishdetailComponent';
10
10
11
11
import { Switch , Route , Redirect , withRouter } from 'react-router-dom' ;
12
12
import { connect } from 'react-redux' ;
13
- import { postComment , fetchDishes , fetchComments , fetchPromos } from '../redux/ActionCreators' ;
13
+ import { postComment , postFeedback , fetchDishes , fetchComments , fetchPromos , fetchLeaders } from '../redux/ActionCreators' ;
14
14
import { actions } from 'react-redux-form' ;
15
15
import { TransitionGroup , CSSTransition } from 'react-transition-group' ;
16
16
@@ -27,14 +27,18 @@ const mapStateToProps = state => {
27
27
28
28
const mapDispatchToProps = ( dispatch ) => ( {
29
29
postComment : ( dishId , rating , author , comment ) => dispatch ( postComment ( dishId , rating , author , comment ) ) ,
30
+
31
+
30
32
fetchDishes : ( ) => { dispatch ( fetchDishes ( ) ) } ,
31
33
resetFeedbackForm : ( ) => { dispatch ( actions . reset ( 'feedback' ) ) } ,
32
34
33
35
fetchComments : ( ) => dispatch ( fetchComments ( ) ) ,
34
-
35
- fetchPromos : ( ) => dispatch ( fetchPromos ( ) )
36
-
37
-
36
+
37
+ fetchPromos : ( ) => dispatch ( fetchPromos ( ) ) ,
38
+ fetchLeaders : ( ) => dispatch ( fetchLeaders ( ) ) ,
39
+
40
+
41
+ postFeedback : ( firstname , lastname , telnum , email , agree , contactType , message ) => dispatch ( postFeedback ( firstname , lastname , telnum , email , agree , contactType , message ) ) ,
38
42
39
43
} ) ;
40
44
@@ -49,6 +53,7 @@ class Main extends Component {
49
53
this . props . fetchDishes ( ) ;
50
54
this . props . fetchComments ( ) ;
51
55
this . props . fetchPromos ( ) ;
56
+ this . props . fetchLeaders ( ) ;
52
57
}
53
58
54
59
render ( ) {
@@ -68,8 +73,11 @@ class Main extends Component {
68
73
promoLoading = { this . props . promotions . isLoading }
69
74
promoErrMess = { this . props . promotions . errMess }
70
75
71
- leader = { this . props . leaders . filter ( ( leader ) => leader . featured ) [ 0 ] }
72
-
76
+ leader = {
77
+ this . props . leaders . leaders . filter ( ( leader ) => leader . featured ) [ 0 ]
78
+ }
79
+ leaderLoading = { this . props . leaders . isLoading }
80
+ leaderErrMess = { this . props . leaders . errMess }
73
81
74
82
/>
75
83
) ;
@@ -83,7 +91,9 @@ class Main extends Component {
83
91
const AboutUsPage = ( ) => {
84
92
return (
85
93
< About
86
- leaders = { this . props . leaders }
94
+ leaders = { this . props . leaders . leaders }
95
+ leaderLoading = { this . props . leaders . isLoading }
96
+ leaderErrMess = { this . props . leaders . errMess }
87
97
/>
88
98
) ;
89
99
} ;
@@ -118,7 +128,13 @@ class Main extends Component {
118
128
119
129
< Route path = "/menu/:dishId" component = { DishWithId } />
120
130
121
- < Route exact path = "/contactus" component = { ( ) => < Contact resetFeedbackForm = { this . props . resetFeedbackForm } /> } />
131
+ < Route exact path = "/contactus" component = { ( ) => < Contact
132
+ resetFeedbackForm = { this . props . resetFeedbackForm }
133
+ postFeedback = { this . props . postFeedback }
134
+
135
+ /> }
136
+ />
137
+
122
138
< Route exact path = "/aboutus" component = { AboutUsPage } />
123
139
124
140
{ /* if url dosesnt match, bydefault redirect to */ }
0 commit comments