mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat: create bulkApprove and bulkReject method
This commit is contained in:
@@ -192,6 +192,29 @@ export class DailyChecklistApiService extends BaseApiService<
|
||||
}
|
||||
}
|
||||
|
||||
async bulkApprove(ids: string[]) {
|
||||
try {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append('ids', ids.join(','));
|
||||
formData.append('status', 'APPROVED');
|
||||
formData.append('reject_reason', '');
|
||||
|
||||
const approvePath = `${this.basePath}/bulk-update`;
|
||||
const approveRes = await httpClient<BaseApiResponse>(approvePath, {
|
||||
method: 'PATCH',
|
||||
body: formData,
|
||||
});
|
||||
|
||||
return approveRes;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async reject(id: string, rejectReason: string) {
|
||||
try {
|
||||
const formData = new FormData();
|
||||
@@ -215,6 +238,29 @@ export class DailyChecklistApiService extends BaseApiService<
|
||||
}
|
||||
}
|
||||
|
||||
async bulkReject(ids: string[], rejectReason: string) {
|
||||
try {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append('ids', ids.join(','));
|
||||
formData.append('status', 'REJECTED');
|
||||
formData.append('reject_reason', rejectReason);
|
||||
|
||||
const rejectPath = `${this.basePath}/bulk-update`;
|
||||
const rejectRes = await httpClient<BaseApiResponse>(rejectPath, {
|
||||
method: 'PATCH',
|
||||
body: formData,
|
||||
});
|
||||
|
||||
return rejectRes;
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async uploadImage(
|
||||
id: number,
|
||||
status: string,
|
||||
|
||||
Reference in New Issue
Block a user