mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
refactor(FE-212): rename PurchaseApi to PurchaseRequisitionsApi and update related references in forms and tables
This commit is contained in:
@@ -33,7 +33,7 @@ import { Supplier } from '@/types/api/master-data/supplier';
|
||||
import { Product } from '@/types/api/master-data/product';
|
||||
import { ProductWarehouseApi } from '@/services/api/inventory';
|
||||
import { isResponseSuccess, isResponseError } from '@/lib/api-helper';
|
||||
import { PurchaseApi } from '@/services/api/purchase';
|
||||
import { PurchaseRequisitionsApi } from '@/services/api/purchase';
|
||||
|
||||
import Card from '@/components/Card';
|
||||
import {
|
||||
@@ -105,7 +105,7 @@ const PurchaseRequisitionsForm = ({
|
||||
// ===== SUBMISSION HANDLERS =====
|
||||
const createPurchaseRequestHandler = useCallback(
|
||||
async (payload: CreatePurchaseRequisitionsPayload) => {
|
||||
const res = await PurchaseApi.create(payload);
|
||||
const res = await PurchaseRequisitionsApi.create(payload);
|
||||
if (isResponseError(res)) {
|
||||
setPurchaseRequestFormErrorMessage(res.message);
|
||||
return;
|
||||
@@ -121,7 +121,10 @@ const PurchaseRequisitionsForm = ({
|
||||
purchaseRequestId: number,
|
||||
payload: CreatePurchaseRequisitionsPayload
|
||||
) => {
|
||||
const res = await PurchaseApi.update(purchaseRequestId, payload);
|
||||
const res = await PurchaseRequisitionsApi.update(
|
||||
purchaseRequestId,
|
||||
payload
|
||||
);
|
||||
if (isResponseError(res)) {
|
||||
setPurchaseRequestFormErrorMessage(res.message);
|
||||
return;
|
||||
@@ -141,7 +144,7 @@ const PurchaseRequisitionsForm = ({
|
||||
if (!initialValues?.id) return;
|
||||
|
||||
setIsDeleteLoading(true);
|
||||
await PurchaseApi.delete(initialValues.id);
|
||||
await PurchaseRequisitionsApi.delete(initialValues.id);
|
||||
deleteModal.closeModal();
|
||||
toast.success('Successfully delete Purchase Request!');
|
||||
setIsDeleteLoading(false);
|
||||
@@ -582,8 +585,8 @@ const PurchaseRequisitionsForm = ({
|
||||
!formik.values.area_id
|
||||
? 'Pilih Area terlebih dahulu'
|
||||
: formik.values.location_id
|
||||
? 'Pilih Gudang...'
|
||||
: 'Pilih Area dan Lokasi terlebih dahulu'
|
||||
? 'Pilih Gudang...'
|
||||
: 'Pilih Area dan Lokasi terlebih dahulu'
|
||||
}
|
||||
value={formik.values.warehouse}
|
||||
onChange={(val) => {
|
||||
|
||||
Reference in New Issue
Block a user