ok
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user