42 lines
775 B
TypeScript
42 lines
775 B
TypeScript
![]() |
import { makeRequest } from "@frontend/kitui";
|
||
|
|
||
|
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/account"
|
||
|
: "https://admin.pena.digital/customer/account";
|
||
|
|
||
|
export const getAccountInfo = async (id: string) =>
|
||
|
makeRequest<never, Account>({
|
||
|
url: `${baseUrl}/${id}`,
|
||
|
method: "GET",
|
||
|
useToken: true,
|
||
|
});
|