Skip to content
New issue

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

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

Already on GitHub? # to your account

Get card type #37

Closed
vein101 opened this issue Dec 6, 2021 · 4 comments
Closed

Get card type #37

vein101 opened this issue Dec 6, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@vein101
Copy link
Contributor

vein101 commented Dec 6, 2021

Is your feature request related to a problem? Please describe.
I need to get the card type.

Describe the solution you'd like
Emit card type when it's set.

Describe alternatives you've considered
Use the regex in form component, but this is unnecessary duplication.

Additional context
Apologies for being over eager and ignoring this with my previous pull request.
I have 2 scenarios, adding a new card and listing existing cards.

  1. Seeing as this already selects the type to display the logo according to the number entered when adding the card, may as well just emit (@get-type="useTypeValue") that instead of duplicating the work somewhere else.

  2. When listing cards I have partial (masked) numbers so it cant figure out the type, so add a 'setType' prop that will display the correct logo.

@guastallaigor guastallaigor added the enhancement New feature or request label Dec 6, 2021
@guastallaigor
Copy link
Owner

Hey @vein101
If I understand correctly you just need a new event to be emitted when changing the card, which emits the type from the cardType computed property?
I'll see what we can do, but if you have an idea of the implementation, let me know, I can accept a PR for it.
Just remember that we need to keep the storybook and tests up to date with new features, even small ones.
I can help with that if you don't want to or doesn't have any experience with them.

@vein101
Copy link
Contributor Author

vein101 commented Dec 7, 2021

@guastallaigor that is correct, I can add this change to my current PR.
I was thinking either to add a watcher to the computed property or change the if's in the computed method to a switch and then emit the type variable before returning it?

@guastallaigor
Copy link
Owner

The watcher approach seems better to me.
Side effects, even a simple emit on a computed property usually are not that good to have in my opinion.

vein101 added a commit to vein101/vue-paycard that referenced this issue Dec 7, 2021
@guastallaigor
Copy link
Owner

ref #36

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants