mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 13:59:00 +00:00
35 lines
883 B
JavaScript
35 lines
883 B
JavaScript
import { get } from "../../../apiUtil";
|
|
import { API_URL } from "../../../constants";
|
|
|
|
export const fetchEmployeesPaged = async ({
|
|
search = "",
|
|
page = 1,
|
|
pageSize = 12,
|
|
}) => {
|
|
const res = await get(
|
|
`${API_URL}/Employee/GetEmployeeList?search=${encodeURIComponent(
|
|
search
|
|
)}&page=${page}&pageSize=${pageSize}`
|
|
);
|
|
|
|
const rows = (res || []).map((x) => ({
|
|
id: x.id,
|
|
name: `${x.name ?? ""} ${x.name ?? ""}`.trim(),
|
|
jobTitle: x.jobTitle ?? "",
|
|
email: x.email ?? "",
|
|
phone: x.phone ?? "",
|
|
department: x.department ?? "",
|
|
status: x.status ?? "",
|
|
}));
|
|
|
|
return {
|
|
rows,
|
|
page: res?.PageNumber ?? 1,
|
|
pageSize: res?.PageSize ?? pageSize,
|
|
totalCount: res?.TotalCount ?? rows.length,
|
|
totalPages: res?.TotalPages ?? 1,
|
|
};
|
|
};
|
|
|
|
export const deleteEmployee = (id) =>
|
|
get(`${API_URL}/Employee/DeleteEmployee?id=${id}`);
|