Skip to content

Commit

Permalink
mend
Browse files Browse the repository at this point in the history
  • Loading branch information
NiyongaboEric committed Feb 24, 2020
1 parent d963acd commit 29361c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/containers/Trips/MulticityTrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ export class MulticityTrip extends Component {
componentDidUpdate(prevProps) {
const { history } = this.props;
const { multicityTripData } = this.props;
const isTripChanged = prevProps.multicityTripData !== multicityTripData;
if (isTripChanged && (multicityTripData.message === 'Trip requested successfully')) {
if (
(prevProps.multicityTripData !== multicityTripData) &&
(multicityTripData.message === 'Trip requested successfully')
) {
return history.push('/requests');
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/containers/TripsContainer/oneway.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ 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;
const isDataChanged = incomingData !== oldData;
if (isDataChanged && (incomingData.message === 'Trip requested successfully')) {
if (
(incomingData !== oldData)
&& (incomingData.message === 'Trip requested successfully')
) {
return history.push(`/requests/${incomingData.data.id}`);
}
}
Expand Down

0 comments on commit 29361c9

Please sign in to comment.