31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import type {TableInput, TableOutput} from "@/models/table";
|
|||
|
|
import type {Fund, FundTransaction} from "@/models/fund";
|
||
|
|
import useAxios from "@/utils/useAxios";
|
||
|
|
import type {Transaction} from "@/models/transaction";
|
||
|
|
|
||
|
|
export const getFundTable = async (tbl?: TableInput): Promise<TableOutput<Fund>> => {
|
||
|
|
return await useAxios.post<TableOutput<Fund>>(`/customer/fund/table`, tbl)
|
||
|
|
}
|
||
|
|
|
||
|
|
export const getFundTransactionTable = async (tbl?: TableInput): Promise<TableOutput<Transaction>> => {
|
||
|
|
return await useAxios.post<TableOutput<Transaction>>(`/customer/fund/transaction/table`, tbl)
|
||
|
|
}
|
||
|
|
|
||
|
|
export const getFundById = async (id: number) => await useAxios.get<Fund>(`/customer/fund/${id}`)
|
||
|
|
|
||
|
|
export const createFund = async (obj: Fund): Promise<any> => {
|
||
|
|
return await useAxios.post(`/customer/fund`, obj)
|
||
|
|
}
|
||
|
|
|
||
|
|
export const editFund = async (id: number, obj: Fund): Promise<any> => {
|
||
|
|
return await useAxios.put(`/customer/fund/${id}`, obj)
|
||
|
|
}
|
||
|
|
export const fundDeposit = async (obj: FundTransaction): Promise<any> => {
|
||
|
|
return await useAxios.post(`/customer/fund/deposit`, obj)
|
||
|
|
}
|
||
|
|
export const fundWithdraw = async (obj: FundTransaction): Promise<any> => {
|
||
|
|
return await useAxios.post(`/customer/fund/withdraw`, obj)
|
||
|
|
}
|
||
|
|
|
||
|
|
export const deleteFund = async (id?: number) => await useAxios.delete(`/customer/fund/${id}`)
|