-
Notifications
You must be signed in to change notification settings - Fork 5
users can delete their cards from their collection #118
base: master
Are you sure you want to change the base?
Conversation
larafa
commented
Apr 26, 2018
- still need to add disappear pop message after clicking yes
- Do I remove the card from the cards list or just set the user id null when the user deletes card from their collection?
Codecov Report
@@ Coverage Diff @@
## master #118 +/- ##
============================================
- Coverage 23.58% 21.53% -2.05%
- Complexity 133 152 +19
============================================
Files 91 93 +2
Lines 1463 1709 +246
Branches 188 219 +31
============================================
+ Hits 345 368 +23
- Misses 1042 1259 +217
- Partials 76 82 +6
Continue to review full report at Codecov.
|
frontend/src/actions/cards.js
Outdated
return dispatch => { | ||
return apiFetch('cards/' + cardId + '/delete', { | ||
method: 'PUT', | ||
body: JSON.stringify(cardId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are passing the cardId through the url, I don't think you need to pass it in through the body
} | ||
|
||
//user doesn't own card | ||
$card->user_id = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine for now, we definitely don't want to remove the card from the db.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah technically we can't remove a card from the blockchain either soooo... we were dumb when writing these stories 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead add a removed
field and set that to true to mark the card as removed.
The user_id field will be automatically repopulated after you 0 it out here.
We can then add a check for that removed field to our card model to make those cards hidden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
} | ||
|
||
//user doesn't own card | ||
$card->user_id = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead add a removed
field and set that to true to mark the card as removed.
The user_id field will be automatically repopulated after you 0 it out here.
We can then add a check for that removed field to our card model to make those cards hidden.