mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-21 22:05:45 +00:00
feat: konfigurasi sistem toggle pemakaian pakan ovk negatif
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import axios from 'axios';
|
||||
import { httpClient, httpClientFetcher } from '@/services/http/client';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
import {
|
||||
SetAllowNegativePakanOvkPayload,
|
||||
SystemSetting,
|
||||
} from '@/types/api/system-settings/system-setting';
|
||||
|
||||
const BASE_PATH = '/system-settings';
|
||||
|
||||
export const SystemSettingsApi = {
|
||||
basePath: BASE_PATH,
|
||||
|
||||
getAllFetcher: (
|
||||
endpoint: string
|
||||
): Promise<BaseApiResponse<SystemSetting[]>> =>
|
||||
httpClientFetcher<BaseApiResponse<SystemSetting[]>>(endpoint),
|
||||
|
||||
async getAll(): Promise<BaseApiResponse<SystemSetting[]> | undefined> {
|
||||
try {
|
||||
return await httpClient<BaseApiResponse<SystemSetting[]>>(BASE_PATH);
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<SystemSetting[]>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
|
||||
async setAllowNegativePakanOvk(
|
||||
payload: SetAllowNegativePakanOvkPayload
|
||||
): Promise<BaseApiResponse | undefined> {
|
||||
try {
|
||||
return await httpClient<BaseApiResponse>(
|
||||
`${BASE_PATH}/allow-negative-pakan-ovk`,
|
||||
{
|
||||
method: 'PATCH',
|
||||
body: payload,
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user