mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Fix back-to-checkoutpage-from-transactionpage bug
This commit is contained in:
parent
ea6ab42429
commit
27cffb31da
1 changed files with 9 additions and 5 deletions
|
|
@ -72,16 +72,20 @@ export class CheckoutPageComponent extends Component {
|
|||
* based on this initial data.
|
||||
*/
|
||||
loadInitialData() {
|
||||
const { bookingData, bookingDates, listing, fetchSpeculatedTransaction } = this.props;
|
||||
const hasDataInProps = !!(bookingData && bookingDates && listing);
|
||||
const pageData = hasDataInProps
|
||||
? { bookingData, bookingDates, listing }
|
||||
: storedData(STORAGE_KEY);
|
||||
const { bookingData, bookingDates, listing, fetchSpeculatedTransaction, history } = this.props;
|
||||
// Browser's back navigation should not rewrite data in session store.
|
||||
// Action is 'POP' on both history.back() and page refresh cases.
|
||||
const hasNavigatedThroughLink = history.action === 'PUSH';
|
||||
|
||||
const hasDataInProps = !!(bookingData && bookingDates && listing) && hasNavigatedThroughLink;
|
||||
if (hasDataInProps) {
|
||||
storeData(bookingData, bookingDates, listing, STORAGE_KEY);
|
||||
}
|
||||
|
||||
const pageData = hasDataInProps
|
||||
? { bookingData, bookingDates, listing }
|
||||
: storedData(STORAGE_KEY);
|
||||
|
||||
const hasData =
|
||||
pageData &&
|
||||
pageData.listing &&
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue