diff --git a/src/assets/css/authentication.scss b/src/assets/css/authentication.scss index 417be96..a043a95 100644 --- a/src/assets/css/authentication.scss +++ b/src/assets/css/authentication.scss @@ -35,6 +35,7 @@ margin: 0 auto; } input { + padding-left: 10px; width: 435px; height: 45px; margin-top: 10px; diff --git a/src/components/Profile.js b/src/components/Profile.js index 4f98dfb..a8124e1 100644 --- a/src/components/Profile.js +++ b/src/components/Profile.js @@ -53,11 +53,11 @@ export class Profile extends Component { const token = localStorage.getItem('token'); this.decode = jwtDecode(token); - const { getProfile, updateSpinnerStatus, getManagers } = this.props; + const { getProfile, updateSpinnerStatus, getManagers, profileError } = this.props; await getManagers(); await getProfile(); - if (this.props.profileError.error - || this.props.profileError.message === 'You have provided an invalid token') { + if (profileError.error + || profileError.message === 'You have provided an invalid token') { return this.props.history.push('/signin'); } } diff --git a/src/containers/Trips/MulticityTrip.js b/src/containers/Trips/MulticityTrip.js index 4b27ee7..c3c06db 100644 --- a/src/containers/Trips/MulticityTrip.js +++ b/src/containers/Trips/MulticityTrip.js @@ -61,10 +61,11 @@ export class MulticityTrip extends Component { componentDidUpdate(prevProps) { const { history } = this.props; const { multicityTripData } = this.props; - if (prevProps.multicityTripData !== multicityTripData) { - if (multicityTripData.message === 'Trip requested successfully') { - return history.push('/requests'); - } + if ( + (prevProps.multicityTripData !== multicityTripData) && + (multicityTripData.message === 'Trip requested successfully') + ) { + return history.push('/requests'); } } diff --git a/src/containers/TripsContainer/Requests.js b/src/containers/TripsContainer/Requests.js index 3def585..b9102aa 100644 --- a/src/containers/TripsContainer/Requests.js +++ b/src/containers/TripsContainer/Requests.js @@ -17,11 +17,11 @@ class Requests extends Component { } async componentDidMount() { - const { fetchRequestsAction, searchResults } = this.props; + const { fetchRequestsAction, searchResults, profileError } = this.props; await searchResults(); await fetchRequestsAction(); - if (this.props.profileError.error - || this.props.profileError.message === 'You have provided an invalid token') { + if (profileError.error + || profileError.message === 'You have provided an invalid token') { return this.props.history.push('/signin'); } } diff --git a/src/containers/TripsContainer/oneway.js b/src/containers/TripsContainer/oneway.js index 82b189e..7b4d50c 100644 --- a/src/containers/TripsContainer/oneway.js +++ b/src/containers/TripsContainer/oneway.js @@ -15,13 +15,14 @@ export class Oneway extends Component { } componentDidUpdate(prevProps) { - const { payload: incomingData } = this.props.tripState.trips.tripRequests; + const { payload: incomingData } = this.props.tripState.trips.tripRequests; const { payload: oldData } = prevProps.tripState.trips.tripRequests; const { history } = this.props; - if (incomingData !== oldData) { - if (incomingData.message === 'Trip requested successfully') { - return history.push(`/requests/${incomingData.data.id}`); - } + if ( + (incomingData !== oldData) + && (incomingData.message === 'Trip requested successfully') + ) { + return history.push(`/requests/${incomingData.data.id}`); } } diff --git a/src/containers/trips/SearchStats.js b/src/containers/trips/SearchStats.js index 270143f..d90384c 100644 --- a/src/containers/trips/SearchStats.js +++ b/src/containers/trips/SearchStats.js @@ -12,12 +12,12 @@ export class Requests extends Component { if (!verifyToken(tokenExist)) { return this.props.history.push('/signin'); } - const { getStatsAction } = this.props; + const { getStatsAction, profileError } = this.props; getStatsAction({ tripType: '1', from: '2020-01-22', to: '2020-01-26' }); - if (this.props.profileError.error - || this.props.profileError.message === 'You have provided an invalid token') { + if (profileError.error + || profileError.message === 'You have provided an invalid token') { return this.props.history.push('/signin'); } } diff --git a/src/views/Dashboard/sidebar/index.js b/src/views/Dashboard/sidebar/index.js index eb41e0a..e36c244 100644 --- a/src/views/Dashboard/sidebar/index.js +++ b/src/views/Dashboard/sidebar/index.js @@ -41,26 +41,27 @@ export class Sidebar extends Component { render() { let backdrop; const { sideDrawerOpen } = this.state; - const { children } = this.props; + const { children, profileError, profile } = this.props; + const { tokenValid } = this.state; + if (sideDrawerOpen) { backdrop = ; } - if(this.state.tokenValid) { - if (this.props.profileError) { - if(this.props.profileError.error) { - return ; - } - if(this.props.profileError.message) { - localStorage.removeItem('token') - return ; - } - }} - if (this.props.profile.data) { - if (!this.props.profile.data.managerId) { - return ; - } + + if(tokenValid && profileError && profileError.error) { + return ; + } + + if(tokenValid && profileError && profileError.message) { + localStorage.removeItem('token') + return ; + } + + if (profile.data && !profile.data.managerId) { + return ; } + return ( <> diff --git a/src/views/accommodation/ViewAccomodation.js b/src/views/accommodation/ViewAccomodation.js index 5d05068..edbb480 100644 --- a/src/views/accommodation/ViewAccomodation.js +++ b/src/views/accommodation/ViewAccomodation.js @@ -65,7 +65,6 @@ export class viewAllAccomodation extends Component { this.refs.mytrips && this.refs.mytrips.children.length > 0 && PaginationStyle(this.refs.mytrips.children, pageNo) - console.log('ooooooooooooo') return ( diff --git a/src/views/bookings/viewSingleBooking.js b/src/views/bookings/viewSingleBooking.js deleted file mode 100644 index e69de29..0000000