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

inCart computed property should be used (L10) #71

Open
lazarosmitsis opened this issue Sep 22, 2021 · 0 comments
Open

inCart computed property should be used (L10) #71

lazarosmitsis opened this issue Sep 22, 2021 · 0 comments

Comments

@lazarosmitsis
Copy link

I think a new computed property should be used to disable/enable the "Remove Item" button.
Instead of checking inStock property, a new inCart property should be used.
The "Remove Item" button should be enabled only if the product id exists in cart - not if it exists in stock!

This is the solution proposed by L10-end:

    <button 
    class="button" 
    :class="{ disabledButton: !inStock }" 
    :disabled="!inStock" 
    @click="removeFromCart">
    Remove Item
  </button>
  <!-- solution -->

This is what I would suggest:

    <button 
    class="button" 
    :class="{ disabledButton: !inCart }" 
    :disabled="!inCart" 
    @click="removeFromCart">
    Remove Item
  </button>
  <!-- solution -->
@lazarosmitsis lazarosmitsis changed the title inCart computed property should be used inCart computed property should be used (L10) Sep 22, 2021
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

No branches or pull requests

1 participant