import { makeRequest } from "@frontend/kitui"; import { parseAxiosError } from "@root/utils/parse-error"; type RawDetail = { Key: string; Value: number | string | RawDetail[]; }; type History = { id: string; userId: string; comment: string; key: string; rawDetails: RawDetail[]; isDeleted: boolean; createdAt: string; updatedAt: string; }; type HistoryResponse = { records: History[]; totalPages: number; }; const baseUrl = process.env.REACT_APP_DOMAIN + "/customer"; const getUserHistory = async ( accountId: string, page: number ): Promise<[HistoryResponse | null, string?]> => { try { const historyResponse = await makeRequest({ method: "GET", url: baseUrl + `/history?page=${page}&limit=${100}&accountID=${accountId}&type=payCart`, }); return [historyResponse]; } catch (nativeError) { const [error] = parseAxiosError(nativeError); return [null, `Ошибка при получении пользователей. ${error}`]; } }; export const historyApi = { getUserHistory, };