74 lines
1.9 KiB
TypeScript
74 lines
1.9 KiB
TypeScript
import httpClient from '@/api/httpClient';
|
|
import { API_URLS } from '@/api/URLs';
|
|
import { AxiosResponse } from 'axios';
|
|
import {
|
|
businessAboutDetailRes,
|
|
businessAboutRes,
|
|
Categories,
|
|
CompanyBody,
|
|
CountryBody,
|
|
ProductBody,
|
|
States,
|
|
} from './types';
|
|
|
|
export const products_api = {
|
|
async getProducts(params: {
|
|
page?: number;
|
|
page_size?: number;
|
|
search?: string;
|
|
}): Promise<AxiosResponse<ProductBody>> {
|
|
const res = await httpClient.get(API_URLS.Get_Products, { params });
|
|
return res;
|
|
},
|
|
|
|
async getCompany(params: {
|
|
page?: number;
|
|
page_size?: number;
|
|
search?: string;
|
|
}): Promise<AxiosResponse<CompanyBody>> {
|
|
const res = await httpClient.get(API_URLS.Get_Company, { params });
|
|
return res;
|
|
},
|
|
|
|
async getCountry(params: {
|
|
page?: number;
|
|
page_size?: number;
|
|
search?: string;
|
|
}): Promise<AxiosResponse<CountryBody>> {
|
|
const res = await httpClient.get(API_URLS.Get_Countries, { params });
|
|
return res;
|
|
},
|
|
|
|
async getStates(): Promise<AxiosResponse<States>> {
|
|
const res = await httpClient.get(API_URLS.Get_States);
|
|
return res;
|
|
},
|
|
|
|
async getCategorys(params?: { parent: number }): Promise<AxiosResponse<Categories>> {
|
|
const res = await httpClient.get(API_URLS.Get_Categories, { params });
|
|
return res;
|
|
},
|
|
|
|
async getCategoryChild(id: number): Promise<AxiosResponse<Categories>> {
|
|
const res = await httpClient.get(API_URLS.Get_Categories_Child(id));
|
|
return res;
|
|
},
|
|
|
|
async businessAbout(params: {
|
|
country?: string;
|
|
district: string;
|
|
page?: number;
|
|
page_size?: number;
|
|
region?: string;
|
|
types?: number;
|
|
}): Promise<AxiosResponse<businessAboutRes>> {
|
|
const res = await httpClient.get(API_URLS.Business_About, { params });
|
|
return res;
|
|
},
|
|
|
|
async businessAboutDetail(id: number): Promise<AxiosResponse<businessAboutDetailRes>> {
|
|
const res = await httpClient.get(API_URLS.Business_About_Detail(id));
|
|
return res;
|
|
},
|
|
};
|