filter hide superadmin from get all user
This commit is contained in:
@@ -13,14 +13,17 @@ const getAllUser = async (queryParams) => {
|
|||||||
|
|
||||||
// Backend returns all data, so we need to do client-side pagination
|
// Backend returns all data, so we need to do client-side pagination
|
||||||
const allData = response.data || [];
|
const allData = response.data || [];
|
||||||
const totalData = allData.length;
|
|
||||||
|
// Filter out users with is_sa = true
|
||||||
|
const filteredData = allData.filter(user => user.is_sa !== true);
|
||||||
|
const totalData = filteredData.length;
|
||||||
|
|
||||||
// Calculate start and end index for current page
|
// Calculate start and end index for current page
|
||||||
const startIndex = (currentPage - 1) * currentLimit;
|
const startIndex = (currentPage - 1) * currentLimit;
|
||||||
const endIndex = startIndex + currentLimit;
|
const endIndex = startIndex + currentLimit;
|
||||||
|
|
||||||
// Slice data for current page
|
// Slice data for current page
|
||||||
const paginatedData = allData.slice(startIndex, endIndex);
|
const paginatedData = filteredData.slice(startIndex, endIndex);
|
||||||
|
|
||||||
// Transform response to match TableList expected structure
|
// Transform response to match TableList expected structure
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user