diff options
| author | Leo Goetz <dev@leogtz.de> | 2026-02-02 11:47:42 +0100 |
|---|---|---|
| committer | Leo Goetz <dev@leogtz.de> | 2026-02-02 11:47:42 +0100 |
| commit | bc09ac8989d5d7cc5e89bca7036b6010815dbee9 (patch) | |
| tree | d5cc8a1f4e99910870589539e5fe86809795e314 /services/Menu.js | |
| parent | d5a420a8135537c9fc36f9dd81ec7c9fc0500e66 (diff) | |
Diffstat (limited to 'services/Menu.js')
| -rw-r--r-- | services/Menu.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/services/Menu.js b/services/Menu.js index 88e3f35..b8e0ebd 100644 --- a/services/Menu.js +++ b/services/Menu.js @@ -3,3 +3,19 @@ import API from "./API.js"; export async function loadData() { app.store.menu = await API.fetchMenu(); } + +export async function getProductById(id) { + if (app.store.menu == null) { + await loadData(); + } + + for (let c of app.store.menu) { + for (let p of c.products) { + if (p.id == id) { + return p; + } + } + } + + return null; +} |
