chore: don't use querystring arg for shop type #326
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 acreateShop
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 aprimary
shop if none exists, or amerchant
shop if aprimary
was already created, there is no reason for us to explicitly pass the desired shop type when callingcreateShop
. We can simply callcreateShop
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 aprimary
shop or amerchant
shop.Breaking changes
None.
Testing
primary
in theShops
MongoDB collection.merchant
in theShops
MongoDB collection.