ok
This commit is contained in:
@@ -402,14 +402,22 @@ export const getReports = async (cafeId, filter) => {
|
||||
);
|
||||
return response.json();
|
||||
};
|
||||
export const getAnalytics = async (filter) => {
|
||||
const response = await fetch(
|
||||
API_BASE_URL + "/transaction/get-analytics" + "?type=" + filter,
|
||||
getHeaders('POST')
|
||||
);
|
||||
|
||||
export const getAnalytics = async (filter, selectedCafeId) => {
|
||||
// Start the URL with the filter type query
|
||||
let url = API_BASE_URL + "/transaction/get-analytics" + "?type=" + filter;
|
||||
|
||||
// Only add selectedCafeId to the query string if it's not null
|
||||
if (selectedCafeId !== null) {
|
||||
url += "&cafeId=" + selectedCafeId;
|
||||
}
|
||||
|
||||
// Fetch with the updated URL
|
||||
const response = await fetch(url, getHeaders('POST'));
|
||||
return response.json();
|
||||
};
|
||||
|
||||
|
||||
export const getIncome = async (cafeId) => {
|
||||
const response = await fetch(
|
||||
`${API_BASE_URL}/transaction/get-income/${cafeId}`,
|
||||
|
||||
Reference in New Issue
Block a user