51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
import { SendRequest } from '../components/Global/ApiRequest';
|
|
|
|
const getAllBrands = async (queryParams) => {
|
|
const response = await SendRequest({
|
|
method: 'get',
|
|
prefix: `brand?${queryParams.toString()}`,
|
|
});
|
|
|
|
return response.data;
|
|
};
|
|
|
|
const getBrandById = async (id) => {
|
|
const response = await SendRequest({
|
|
method: 'get',
|
|
prefix: `brand/${id}`,
|
|
});
|
|
|
|
return response.data;
|
|
};
|
|
|
|
const createBrand = async (queryParams) => {
|
|
const response = await SendRequest({
|
|
method: 'post',
|
|
prefix: `brand`,
|
|
params: queryParams,
|
|
});
|
|
|
|
return response.data;
|
|
};
|
|
|
|
const updateBrand = async (id, queryParams) => {
|
|
const response = await SendRequest({
|
|
method: 'put',
|
|
prefix: `brand/${id}`,
|
|
params: queryParams,
|
|
});
|
|
|
|
return response.data;
|
|
};
|
|
|
|
const deleteBrand = async (id) => {
|
|
const response = await SendRequest({
|
|
method: 'delete',
|
|
prefix: `brand/${id}`,
|
|
});
|
|
|
|
return response.data;
|
|
};
|
|
|
|
export { getAllBrands, getBrandById, createBrand, updateBrand, deleteBrand };
|