Error handling on shoppiong page meal selection
This commit is contained in:
parent
d69128a334
commit
762549f4c4
1 changed files with 12 additions and 4 deletions
|
|
@ -157,13 +157,21 @@ async function loadData() {
|
|||
}
|
||||
|
||||
async function mealSelected(meal: { id: number }) {
|
||||
try {
|
||||
await requestMeal(meal.id)
|
||||
await loadData()
|
||||
} catch (err) {
|
||||
showAlert({ type: 'error', heading: 'Failed to include meal', message: err instanceof Error ? err.message : 'Unknown error' })
|
||||
}
|
||||
}
|
||||
|
||||
async function mealUnselected(meal: { id: number }) {
|
||||
try {
|
||||
await unrequestMeal(meal.id)
|
||||
await loadData()
|
||||
} catch (err) {
|
||||
showAlert({ type: 'error', heading: 'Failed to un-include meal', message: err instanceof Error ? err.message : 'Unknown error' })
|
||||
}
|
||||
}
|
||||
|
||||
async function markFound() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue