mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2025-05-20 18:34:53 +00:00
Use array of UUIDs + Amount for cart data
This is very unstable, but works on the power of will and hope
This commit is contained in:
parent
b7bc7da366
commit
04f7d40e52
4 changed files with 73 additions and 27 deletions
|
@ -18,7 +18,7 @@ export async function getAnnouncements() {
|
|||
image: "/BannerExampleImage.jpg",
|
||||
};
|
||||
cache.announcement_banner = data;
|
||||
await fakeDelay(5000)
|
||||
await fakeDelay(200)
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ export async function getPopularToday() {
|
|||
|
||||
const data = Items;
|
||||
cache.popular_today = data;
|
||||
await fakeDelay(2000)
|
||||
await fakeDelay(200)
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -62,9 +62,9 @@ export async function getItemByUUID(uuid) {
|
|||
if (item.uuid === uuid) {
|
||||
data = item;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
await fakeDelay(1000)
|
||||
await fakeDelay(200)
|
||||
|
||||
if (!data) {
|
||||
throw new Error("Resource could not be found");
|
||||
|
@ -74,8 +74,29 @@ export async function getItemByUUID(uuid) {
|
|||
}
|
||||
|
||||
|
||||
export async function getItemsByUUID(items) {
|
||||
let data = [];
|
||||
|
||||
Items.forEach((itemInDatabase) => {
|
||||
items.forEach((itemInRequest) => {
|
||||
if (itemInDatabase.uuid === itemInRequest) {
|
||||
data.push(itemInDatabase);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
await fakeDelay(200)
|
||||
|
||||
if (data.length < 0) {
|
||||
throw new Error("Resource could not be found");
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
export async function postContactEmail(name, email, message) {
|
||||
await fakeDelay(1000)
|
||||
await fakeDelay(200)
|
||||
|
||||
if (!name) {
|
||||
throw new Error("Namey missing");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue