customers

This commit is contained in:
joshikannan
2025-11-27 18:33:08 +05:30
parent e71e44319c
commit d73c714290
19 changed files with 595 additions and 2070 deletions

View File

@@ -1,4 +1,5 @@
import axios from 'axios';
import { OpenToast } from 'components/nearle_components/OpenToast';
const tenid = localStorage.getItem('tenantid');
export const fetchOrders = async ({ pageParam = 1, queryKey }) => {
@@ -103,6 +104,28 @@ export const fetchCustomersList = async ({ queryKey }) => {
console.log('fetchCustomersList', response.data.details);
return response.data.details;
};
// ==============================|| gettenantcustomers (customers)||============================== //
export const gettenantcustomers = async ({ pageParam = 1, queryKey }) => {
const [, rowsPerPage, customerSearch] = queryKey;
try {
const response = await axios.get(
`${process.env.REACT_APP_URL}/customers/gettenantcustomers/?tenantid=${tenid}&pageno=${pageParam}&pagesize=${rowsPerPage}&keyword=${customerSearch}`
);
const details = response.data.details ?? [];
return {
details,
nextPage: details.length === rowsPerPage ? pageParam + 1 : undefined
};
} catch (err) {
OpenToast(err.message, 'error', 1000);
return { details: [], nextPage: undefined };
}
};
// ==============================|| fetchCustomersListBySearch (customers)||============================== //
export const fetchCustomersListBySearch = async ({ queryKey }) => {
const [search] = queryKey;