import { makeRequest } from "@frontend/kitui"; import { parseAxiosError } from "@root/utils/parse-error"; type Name = { firstname: string; secondname: string; middlename: string; orgname: string; }; type Wallet = { currency: string; cash: number; purchasesAmount: number; spent: number; money: number; }; export type Account = { _id: string; userId: string; cart: string[]; status: string; isDeleted: boolean; createdAt: string; updatedAt: string; deletedAt: string; name: Name; wallet: Wallet; }; const baseUrl = process.env.NODE_ENV === "production" ? "/customer" : "https://admin.pena.digital/customer"; export const getAccountInfo = async ( id: string ): Promise<[Account | null, string?]> => { try { const accountInfoResponse = await makeRequest({ url: `/account${baseUrl}/${id}`, method: "GET", useToken: true, }); return [accountInfoResponse]; } catch (nativeError) { const [error] = parseAxiosError(nativeError); return [null, `Не удалось получить информацию об аккаунте. ${error}`]; } };