This commit is contained in:
frontend perkafean
2024-09-28 17:34:48 +00:00
parent 4f6b9223ec
commit d84e47bba9
2 changed files with 89 additions and 51 deletions

View File

@@ -13,7 +13,7 @@ export async function confirmTransaction(transactionId) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
},
);
if (!response.ok) {
return false;
@@ -37,7 +37,7 @@ export async function declineTransaction(transactionId) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
},
);
if (!response.ok) {
@@ -61,7 +61,7 @@ export async function cancelTransaction(transactionId) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
},
);
console.log(response);
@@ -86,7 +86,7 @@ export async function handleClaimHasPaid(transactionId) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
},
);
if (!response.ok) {
@@ -111,7 +111,7 @@ export async function handleConfirmHasPaid(transactionId) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
},
);
if (!response.ok) {
@@ -135,7 +135,7 @@ export async function getTransaction(transactionId) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
},
);
if (!response.ok) {
@@ -160,7 +160,7 @@ export async function getTransactions(shopId, demand) {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
}
},
);
if (!response.ok) {
@@ -179,7 +179,7 @@ export const handlePaymentFromClerk = async (
user_email,
payment_type,
serving_type,
tableNo
tableNo,
) => {
try {
const token = getLocalStorage("auth");
@@ -208,7 +208,7 @@ export const handlePaymentFromClerk = async (
tableNo,
transactions: structuredItems,
}),
}
},
);
if (response.ok) {
@@ -233,7 +233,7 @@ export const handlePaymentFromGuestSide = async (
user_email,
payment_type,
serving_type,
tableNo
tableNo,
) => {
try {
const token = getLocalStorage("authGuestSide");
@@ -262,7 +262,7 @@ export const handlePaymentFromGuestSide = async (
tableNo,
transactions: structuredItems,
}),
}
},
);
const res = await response.json();
console.log(res);
@@ -289,7 +289,7 @@ export const handlePaymentFromGuestDevice = async (
serving_type,
tableNo,
notes,
socketId
socketId,
) => {
try {
const token = getLocalStorage("auth");
@@ -319,7 +319,7 @@ export const handlePaymentFromGuestDevice = async (
notes: notes,
socketId,
}),
}
},
);
if (response.ok) {
@@ -364,7 +364,7 @@ const getHeaders = (method = "GET") => {
export const getFavourite = async (cafeId) => {
const response = await fetch(
`${API_BASE_URL}/transaction/get-favourite/${cafeId}`,
getHeaders()
getHeaders(),
);
return response.json();
};
@@ -377,7 +377,7 @@ export const getAnalytics = async (cafeId, filter) => {
headers: {
"Content-Type": "application/json",
},
}
},
);
return response.json();
};
@@ -385,7 +385,7 @@ export const getAnalytics = async (cafeId, filter) => {
export const getIncome = async (cafeId) => {
const response = await fetch(
`${API_BASE_URL}/transaction/get-income/${cafeId}`,
getHeaders()
getHeaders(),
);
return response.json();
};