mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
refactor(FE-212,213): unify purchase API service references in Purchase components
This commit is contained in:
@@ -33,7 +33,7 @@ import {
|
||||
import { Supplier } from '@/types/api/master-data/supplier';
|
||||
import { Product } from '@/types/api/master-data/product';
|
||||
import { isResponseSuccess, isResponseError } from '@/lib/api-helper';
|
||||
import { PurchaseRequestApi } from '@/services/api/purchase';
|
||||
import { PurchaseApi } from '@/services/api/purchase';
|
||||
|
||||
import Card from '@/components/Card';
|
||||
import {
|
||||
@@ -99,7 +99,7 @@ const PurchaseRequestForm = ({
|
||||
// ===== SUBMISSION HANDLERS =====
|
||||
const createPurchaseRequestHandler = useCallback(
|
||||
async (payload: CreatePurchaseRequestPayload) => {
|
||||
const res = await PurchaseRequestApi.create(payload);
|
||||
const res = await PurchaseApi.create(payload);
|
||||
if (isResponseError(res)) {
|
||||
setPurchaseRequestFormErrorMessage(res.message);
|
||||
return;
|
||||
@@ -115,7 +115,7 @@ const PurchaseRequestForm = ({
|
||||
purchaseRequestId: number,
|
||||
payload: CreatePurchaseRequestPayload
|
||||
) => {
|
||||
const res = await PurchaseRequestApi.update(purchaseRequestId, payload);
|
||||
const res = await PurchaseApi.update(purchaseRequestId, payload);
|
||||
if (isResponseError(res)) {
|
||||
setPurchaseRequestFormErrorMessage(res.message);
|
||||
return;
|
||||
@@ -135,7 +135,7 @@ const PurchaseRequestForm = ({
|
||||
if (!initialValues?.id) return;
|
||||
|
||||
setIsDeleteLoading(true);
|
||||
await PurchaseRequestApi.delete(initialValues.id);
|
||||
await PurchaseApi.delete(initialValues.id);
|
||||
deleteModal.closeModal();
|
||||
toast.success('Successfully delete Purchase Request!');
|
||||
setIsDeleteLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user