This commit is contained in:
zadit
2024-11-19 00:31:28 +07:00
parent b8c1d30d14
commit 7daa8d6653
6 changed files with 284 additions and 255 deletions

View File

@@ -390,9 +390,9 @@ export const getFavourite = async (cafeId) => {
return response.json();
};
export const getAnalytics = async (cafeId, filter) => {
export const getReports = async (cafeId, filter) => {
const response = await fetch(
API_BASE_URL + "/transaction/get-analytics/" + cafeId + "?type=" + filter,
API_BASE_URL + "/transaction/reports/" + cafeId + "?type=" + filter,
{
method: "POST",
headers: {
@@ -402,6 +402,13 @@ export const getAnalytics = 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')
);
return response.json();
};
export const getIncome = async (cafeId) => {
const response = await fetch(

View File

@@ -175,7 +175,7 @@ export const getAllCafeOwner = async (formData) => {
const token = getLocalStorage("auth");
if (token) {
try {
const response = await fetch(API_BASE_URL + "/user/get-admin", {
const response = await fetch(API_BASE_URL + "/transaction/get-analytics", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -186,6 +186,7 @@ export const getAllCafeOwner = async (formData) => {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log(data)
return data;
} catch (error) {
console.error("Error updating user:", error);