20 lines
632 B
TypeScript
20 lines
632 B
TypeScript
import axios from "@/config/axios";
|
|
import { API_ENDPOINTS } from "@/config/api";
|
|
import type { PageResult, Audits } from "@/types/audit";
|
|
|
|
export async function getAudits(
|
|
pageNumber = 1,
|
|
pageSize = 20,
|
|
username?: string | null,
|
|
action?: string | null,
|
|
from?: string | null,
|
|
to?: string | null
|
|
): Promise<PageResult<Audits>> {
|
|
const response = await axios.get<PageResult<Audits>>(API_ENDPOINTS.AUDIT.GET_AUDITS, {
|
|
params: { pageNumber, pageSize, username, action, from, to },
|
|
});
|
|
|
|
// API trả về camelCase khớp với PageResult<Audits> — dùng trực tiếp, không cần map
|
|
return response.data;
|
|
}
|