init
This commit is contained in:
38
src/data/party/party.requests.ts
Normal file
38
src/data/party/party.requests.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Party, PartyStatus } from '@/data/party/party.model';
|
||||
import { CommonResponseType, PageAble } from '@/helpers/types';
|
||||
import { request } from '@/services/request';
|
||||
|
||||
export const party_requests = {
|
||||
async getAll(params?: { page?: number; sort?: string; direction?: string; partyName?: string; status?: PartyStatus }) {
|
||||
return request.get<CommonResponseType<PageAble<Party>>>('/parties/list', { params });
|
||||
},
|
||||
async changeStatus(params: { partyId: string | number; status: PartyStatus }) {
|
||||
return request.put('/parties/change', undefined, { params });
|
||||
},
|
||||
async create(body: { name: string }) {
|
||||
return request.post<CommonResponseType>('/parties/create', body);
|
||||
},
|
||||
async update(body: { id: number | string; name: string }) {
|
||||
return request.put<CommonResponseType<Party[]>>(
|
||||
'/parties/update',
|
||||
{ name: body.name },
|
||||
{
|
||||
params: {
|
||||
partyId: body.id,
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
async find(params: { partyId: number | string }) {
|
||||
return request.get<CommonResponseType<Party>>('/parties/find', { params });
|
||||
},
|
||||
async delete(params: { partyId: number | string }) {
|
||||
return request.delete<CommonResponseType>('/parties/delete', { params });
|
||||
},
|
||||
async downloadExcel(params: { partyId: number | string }) {
|
||||
return request.get<Blob>('/parties/download', { params, responseType: 'blob' });
|
||||
},
|
||||
async downloadPartyItemsExcel(params: { partyId: number | string }) {
|
||||
return request.get<Blob>('/parties/items/download', { params, responseType: 'blob' });
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user