Files
boursecu_admin/src/api/customer.ts
T

40 lines
1.8 KiB
TypeScript

import useAxios from '@core/utils/useAxios'
import type { AddId, Customer } from '@/model/customer'
import type { TableInput } from '@core/type/baseTable'
import type {CheckCardRequest, CheckCardResponse} from "@/model/user";
export const createCustomer = async (obj: Customer) =>
await useAxios.post<AddId>(`/admin/customer`, obj)
export const deleteCustomer = async (id: number) => await useAxios.delete(`/admin/customer/${id}`)
export const updateCustomer = async (id: number, obj: Customer) =>
await useAxios.put<AddId>(`/admin/customer/${id}`, obj)
export const getCustomerTable = async (params: TableInput) =>
await useAxios.post<Array<Customer>>('/admin/customer/table', params)
export const getCustomersList = async () => await useAxios.get<Customer[]>(`/admin/customer/list`)
export const changeCustomerActivation = async (id: number) =>
await useAxios.get(`/admin/customer/active/${id}`)
export const changeCustomerOrderActivation = async (id: number) =>
await useAxios.get(`/admin/customer/trade/${id}`)
export const changeCustomerArchive = async (id: number) =>
await useAxios.get(`/admin/customer/archive/${id}`)
export const confirmUser = async (id: number) =>
await useAxios.get(`/admin/customer/is_valid/${id}`)
export const getCustomerArchiveTable = async (params: TableInput) =>
await useAxios.post<Array<Customer>>('/admin/customer/archive/table', params)
export const getSingleTable = async (params: TableInput) =>
await useAxios.post<Array<Customer>>('/admin/customer/single/table', params)
export const getSingleArchiveTable = async (params: TableInput) =>
await useAxios.post<Array<Customer>>('/admin/customer/single/archive/table', params)
export const checkCard = async (data: CheckCardRequest) => {
return await useAxios.post<CheckCardResponse>('/admin/check_card', data)
}