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

chore: don't use querystring arg for shop type #326

Conversation

loan-laux
Copy link
Contributor

Signed-off-by: Loan Laux [email protected]

Impact: minor
Type: refactor|chore

Issue

In one of my previous pull requests, I introduced a separate /new-shop page for users to create new shops. This page would get the desired shop type (then passed as a createShop mutation parameter) from the querystring. To get the current user to create a primary shop, you would redirect them to /new-shop?primary=true, or you'd omit the querystring altogether for a secondary shop.

Since the createShop mutation already creates a primary shop if none exists, or a merchant shop if a primary was already created, there is no reason for us to explicitly pass the desired shop type when calling createShop. We can simply call createShop without a shop type, which will result in the same experience to end-users, with less confusion for developers.

Solution

Remove the use of the querystring parameter to set the shop type. Don't pass the shop type when calling createShop, letting the mutation figure out on its own whether to create a primary shop or a merchant shop.

Breaking changes

None.

Testing

  1. Create a shop on a fresh new install. The created shop should be of type primary in the Shops MongoDB collection.
  2. With this primary shop created, create a second shop. This new shop should be of type merchant in the Shops MongoDB collection.

Copy link
Contributor

@rosshadden rosshadden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks

@rosshadden rosshadden merged commit 2493231 into reactioncommerce:trunk Oct 5, 2020
@mikemurray mikemurray mentioned this pull request Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants