This commit is contained in:
insvrgent
2025-02-03 17:48:48 +07:00
parent 8676621fe2
commit 66f73bc1ba
5 changed files with 84 additions and 22 deletions

View File

@@ -14,7 +14,7 @@ export async function getCafe(cafeId) {
});
if (!response.ok) {
throw new Error("Failed to fetch cafes");
return false
}
const cafe = await response.json();
@@ -51,7 +51,7 @@ export const saveWelcomePageConfig = async (cafeId, details) => {
});
if (!response.ok) {
throw new Error("Failed to save welcome page configuration");
return false
}
return await response.json();
@@ -98,7 +98,7 @@ export async function getOwnedCafes(userId) {
);
if (!response.ok) {
throw new Error("Failed to fetch cafes");
return false
}
const cafes = await response.json();
@@ -109,6 +109,7 @@ export async function getOwnedCafes(userId) {
}
export async function createCafe(cafeName) {
console.log(cafeName)
try {
const response = await fetch(`${API_BASE_URL}/cafe/create-cafe`, {
method: "POST",
@@ -122,7 +123,7 @@ export async function createCafe(cafeName) {
});
if (!response.ok) {
throw new Error("Failed to create cafe");
return false
}
const cafe = await response.json();
@@ -144,7 +145,7 @@ export async function updateCafe(cafeId, cafeDetails) {
});
if (!response.ok) {
throw new Error("Failed to update cafe");
return false
}
const updatedCafe = await response.json();
@@ -169,7 +170,7 @@ export async function setConfirmationStatus(cafeId, isNeedConfirmation) {
);
if (!response.ok) {
// throw new Error(`Error: ${response.statusText}`);
return false
}
const data = await response.json();
@@ -177,7 +178,7 @@ export async function setConfirmationStatus(cafeId, isNeedConfirmation) {
return data;
} catch (error) {
console.error("Failed to update item type:", error);
throw error;
return false
}
}
@@ -228,7 +229,7 @@ export async function saveCafeDetails(cafeId, details) {
});
if (!response.ok) {
throw new Error("Failed to save cafe details");
return false
}
return await response.json();