Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckoutPage: selected booking dates should be available after login #852

Merged
merged 2 commits into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version
* [fix] Improve slug creation (slashes were breaking rendering in some environments)
[#850](https://github.com/sharetribe/flex-template-web/pull/850)
[#850](https://github.com/sharetribe/flex-template-web/pull/850)
* [fix] Anonymous user should see contact link on UserCard
[#851](https://github.com/sharetribe/flex-template-web/pull/851)
[#851](https://github.com/sharetribe/flex-template-web/pull/851)
* [fix] Persisting booking request details across authentication
[#852](https://github.com/sharetribe/flex-template-web/pull/852)

## v1.0.0

Expand Down
6 changes: 5 additions & 1 deletion src/containers/CheckoutPage/CheckoutPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,17 @@ export class CheckoutPageComponent extends Component {
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';
// Action is 'PUSH' when user has directed through a link
// Action is 'REPLACE' when user has directed through login/signup process
const hasNavigatedThroughLink = history.action === 'PUSH' || history.action === 'REPLACE';

const hasDataInProps = !!(bookingData && bookingDates && listing) && hasNavigatedThroughLink;
if (hasDataInProps) {
// Store data only if data is passed through props and user has navigated through a link.
storeData(bookingData, bookingDates, listing, STORAGE_KEY);
}

// NOTE: stored data can be empty if user has already successfully completed transaction.
const pageData = hasDataInProps
? { bookingData, bookingDates, listing }
: storedData(STORAGE_KEY);
Expand Down