-
Notifications
You must be signed in to change notification settings - Fork 1
adds clear reservations button #57
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
base: dev
Are you sure you want to change the base?
Conversation
| const clearReservations = () => { | ||
| let waitLength = waitList.length; | ||
| let holdLength = holdList.length; | ||
|
|
||
| if (waitLength === 0 && holdLength === 0) { | ||
| return alert('No reservations to cancel.'); | ||
| } | ||
| if (waitLength !== 0) { | ||
| waitList.forEach((res) => { | ||
| let data = { queueStatus: 'cancelled' } | ||
| props.dispatchUpdateReservation(data, res.id); | ||
| }); | ||
| alert(`Wait list cleared ${waitLength} reservations.`) | ||
| }; | ||
| if (holdLength !== 0) { | ||
| holdList.forEach((res) => { | ||
| let data = { queueStatus: 'cancelled' } | ||
| props.dispatchUpdateReservation(data, res.id); | ||
| }) | ||
| alert(`Hold list cleared ${holdLength} reservations.`) | ||
| } | ||
| return | ||
| }; |
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.
Hey, I don't think this is good. This requires the front end to fire off a request to the backend for every single reservation on the front, that could be a lot of calls. I think we need to create a new backend route that will update the reservations based on what's saved in the retailer's reservation array.
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.
Lemme know if you wanna discuss and we can talk about what that might look like.
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.
Ok I'll look into updating multiple documents with one call
WaitList includes a clear button on top
It maps through waitList/holdList and changes their status in db to "cancelled"