@@ -2,7 +2,9 @@ import React from 'react';
22import { connect } from 'react-redux' ;
33import { CSSTransitionGroup } from 'react-transition-group' ;
44
5- import { showLoadingMessage , showErrorMessage , hideLoadingMessage , getErrorMessage } from './components/Store/Actions.js' ;
5+ import { showLoadingMessage , showErrorMessage , hideLoadingMessage } from './components/Store/Actions.js' ;
6+
7+ import { baseUrl } from './utils/baseUrl' ;
68
79import TopNavBar from './components/TopNavBar/TopNavBar' ;
810import Form from './components/Form/Form' ;
@@ -17,19 +19,18 @@ import scale from './styles/transitions/scale.scss';
1719
1820const mapStateToProps = state => {
1921 return {
20- showLoadingMessage : state . toggleLoadingMessage ,
21- showErrorMessage : state . toggleErrorMessage ,
22- errorMessage : state . toggleErrorMessage ,
23- currentTabIndex : state . setActiveIndex
22+ showLoadingMessage : state . loadingMessage . isLoading ,
23+ loadingMessage : state . loadingMessage . message ,
24+ showErrorMessage : state . errorMessage . hasError ,
25+ errorMessage : state . errorMessage . message
2426 }
2527}
2628
2729const mapDispatchToProps = dispatch => {
2830 return {
29- loadingMessageOn : ( ) => dispatch ( showLoadingMessage ( ) ) ,
31+ loadingMessageOn : message => dispatch ( showLoadingMessage ( message ) ) ,
3032 loadingMessageOff : ( ) => dispatch ( hideLoadingMessage ( ) ) ,
31- errorMessageOn : ( ) => dispatch ( showErrorMessage ( ) ) ,
32- getErrorMessage : message => dispatch ( getErrorMessage ( message ) ) ,
33+ errorMessageOn : message => dispatch ( showErrorMessage ( message ) ) ,
3334 }
3435}
3536
@@ -48,7 +49,7 @@ class App extends React.Component {
4849 }
4950
5051 componentDidMount ( ) {
51- this . fetchData ( 'http://localhost:9090/ solc/list') ;
52+ this . fetchData ( baseUrl + ' solc/list') ;
5253 }
5354
5455 handleMenuItemIconClick ( index ) {
@@ -97,7 +98,7 @@ class App extends React.Component {
9798 }
9899
99100 handleRequestPending ( ) {
100- this . props . loadingMessageOn ( ) ;
101+ this . props . loadingMessageOn ( 'Loading...' ) ;
101102 }
102103
103104 handleRequestSuccess ( response ) {
@@ -119,14 +120,13 @@ class App extends React.Component {
119120
120121 handleRequestFail ( message ) {
121122 this . props . loadingMessageOff ( ) ;
122- this . props . errorMessageOn ( ) ;
123- this . props . getErrorMessage ( message ) ;
123+ this . props . errorMessageOn ( message ) ;
124124 }
125125
126126 render ( ) {
127127
128128 const { fetchRequestStatus, contracts, versions } = this . state ;
129- const { showLoadingMessage, showErrorMessage, errorMessage } = this . props ;
129+ const { showLoadingMessage, showErrorMessage, errorMessage, loadingMessage } = this . props ;
130130
131131 return (
132132 < div className = { styles [ 'app' ] } >
@@ -146,18 +146,18 @@ class App extends React.Component {
146146 transitionName = { fade }
147147 transitionAppear = { true }
148148 transitionAppearTimeout = { 300 }
149- trnasitionEnterTimeout = { 300 }
149+ transitionEnterTimeout = { 300 }
150150 transitionLeaveTimeout = { 300 }
151151 >
152152 { showLoadingMessage &&
153- < MessageComp message = 'Loading...' />
153+ < MessageComp message = { loadingMessage } />
154154 }
155155 </ CSSTransitionGroup >
156156 < CSSTransitionGroup
157157 transitionName = { fade }
158158 transitionAppear = { true }
159159 transitionAppearTimeout = { 300 }
160- trnasitionEnterTimeout = { 300 }
160+ transitionEnterTimeout = { 300 }
161161 transitionLeaveTimeout = { 300 }
162162 >
163163 { showErrorMessage &&
@@ -172,7 +172,7 @@ class App extends React.Component {
172172 transitionName = { scale }
173173 transitionAppear = { true }
174174 transitionAppearTimeout = { 300 }
175- trnasitionEnterTimeout = { 300 }
175+ transitionEnterTimeout = { 300 }
176176 transitionLeaveTimeout = { 300 }
177177 >
178178 { fetchRequestStatus === 'success' && contracts . length &&
0 commit comments