customers
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user