chore(FE-41): delete nonstock api helper function file

This commit is contained in:
ValdiANS
2025-10-08 14:56:52 +07:00
parent 3e7da624aa
commit 8461667ca2
-87
View File
@@ -1,87 +0,0 @@
import axios from 'axios';
import { httpClient } from '@/services/http/client';
import {
CreateNonstockPayload,
DeleteNonstockResponse,
NonstockResponse,
UpdateNonstockPayload,
} from '@/types/api/master-data/nonstock';
export const getNonstock = async (nonstockId: number) => {
try {
const getNonstockRes = await httpClient<NonstockResponse>(
`/master-data/nonstocks/${nonstockId}`
);
return getNonstockRes;
} catch (error: unknown) {
if (axios.isAxiosError<NonstockResponse>(error)) {
return error.response?.data;
}
return undefined;
}
};
export const createNonstock = async (payload: CreateNonstockPayload) => {
try {
const createNonstockRes = await httpClient<NonstockResponse>(
'/master-data/nonstocks',
{
method: 'POST',
body: payload,
}
);
return createNonstockRes;
} catch (error: unknown) {
if (axios.isAxiosError<NonstockResponse>(error)) {
return error.response?.data;
}
return undefined;
}
};
export const updateNonstock = async (
nonstockId: number,
payload: UpdateNonstockPayload
) => {
try {
const updateNonstockRes = await httpClient<NonstockResponse>(
`/master-data/nonstocks/${nonstockId}`,
{
method: 'PATCH',
body: payload,
}
);
return updateNonstockRes;
} catch (error: unknown) {
if (axios.isAxiosError<NonstockResponse>(error)) {
return error.response?.data;
}
return undefined;
}
};
export const deleteNonstock = async (nonstockId: number) => {
try {
const deleteNonstockRes = await httpClient<DeleteNonstockResponse>(
`/master-data/nonstocks/${nonstockId}`,
{
method: 'DELETE',
}
);
return deleteNonstockRes;
} catch (error) {
if (axios.isAxiosError<DeleteNonstockResponse>(error)) {
return error.response?.data;
}
return undefined;
}
};