ok
This commit is contained in:
@@ -23,6 +23,27 @@ export async function getCafe(cafeId) {
|
||||
console.error("Error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function getPaymentMethods(cafeId) {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE_URL}/cafe/get-payment-methods/` + cafeId, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
return false
|
||||
}
|
||||
|
||||
const payments = await response.json();
|
||||
return payments;
|
||||
} catch (error) {
|
||||
console.error("Error:", error);
|
||||
}
|
||||
}
|
||||
// api.js
|
||||
export const saveWelcomePageConfig = async (cafeId, details) => {
|
||||
const formData = new FormData();
|
||||
@@ -182,6 +203,32 @@ export async function setConfirmationStatus(cafeId, isNeedConfirmation) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function setOpenBillAvailability(cafeId, isOpenBillAvailable) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE_URL}/cafe/openbill-availability/` + cafeId,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${getAuthToken()}`,
|
||||
},
|
||||
body: JSON.stringify({ isOpenBillAvailable: isOpenBillAvailable }),
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
return false
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log(data);
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error("Failed to update item type:", error);
|
||||
return false
|
||||
}
|
||||
}
|
||||
// helpers/cafeHelpers.js
|
||||
export async function saveCafeDetails(cafeId, details) {
|
||||
try {
|
||||
@@ -221,8 +268,12 @@ export async function saveCafeDetails(cafeId, details) {
|
||||
if (details.qrSize) formData.append("scale", details.qrSize);
|
||||
|
||||
if (details.cafeIdentifyName) formData.append("cafeIdentifyName", details.cafeIdentifyName);
|
||||
console.log(details.cafeIdentifyName)
|
||||
if (details.name) formData.append("name", details.name);
|
||||
|
||||
if (details.isQRISavailable !== undefined)formData.append("isQRISavailable", details.isQRISavailable)
|
||||
if (details.isOpenBillAvailable !== undefined)formData.append("isOpenBillAvailable", details.isOpenBillAvailable)
|
||||
if (details.isNeedConfirmationState !== undefined)formData.append("isNeedConfirmationState", details.isNeedConfirmationState)
|
||||
console.log(details)
|
||||
const response = await fetch(`${API_BASE_URL}/cafe/set-cafe/${cafeId}`, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user