mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat(FE-333): adding feature overhead closing report
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
ClosingGeneralInformation,
|
||||
ClosingIncomingSapronak,
|
||||
ClosingOutgoingSapronak,
|
||||
ClosingOverhead,
|
||||
ClosingSapronakCalculation,
|
||||
} from '@/types/api/closing';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
@@ -16,6 +17,7 @@ import {
|
||||
dummyGetAllOutgoingSapronakFetcher,
|
||||
dummyGetGeneralInfo,
|
||||
dummyGetPerhitunganSapronak,
|
||||
dummyGetOverhead,
|
||||
} from '@/dummy/closing.dummy';
|
||||
import { httpClient, httpClientFetcher } from '@/services/http/client';
|
||||
|
||||
@@ -73,12 +75,12 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||
endpoint: string
|
||||
): Promise<BaseApiResponse<ClosingOutgoingSapronak[]>> {
|
||||
// TODO: Remove this block when backend is ready
|
||||
// return await dummyGetAllOutgoingSapronakFetcher();
|
||||
return await dummyGetAllOutgoingSapronakFetcher();
|
||||
|
||||
// Uncomment this when backend is ready
|
||||
return await httpClientFetcher<BaseApiResponse<ClosingOutgoingSapronak[]>>(
|
||||
endpoint
|
||||
);
|
||||
// return await httpClientFetcher<BaseApiResponse<ClosingOutgoingSapronak[]>>(
|
||||
// endpoint
|
||||
// );
|
||||
}
|
||||
|
||||
async getGeneralInfo(
|
||||
@@ -147,6 +149,33 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async getOverhead(
|
||||
id: number
|
||||
): Promise<BaseApiResponse<ClosingOverhead> | undefined> {
|
||||
// TODO: Remove this block when backend is ready
|
||||
// try {
|
||||
// return await dummyGetOverhead(id);
|
||||
// } catch (error) {
|
||||
// if (axios.isAxiosError<BaseApiResponse<ClosingOverhead>>(error)) {
|
||||
// return error.response?.data;
|
||||
// }
|
||||
// return undefined;
|
||||
// }
|
||||
|
||||
// Uncomment this when backend is ready
|
||||
try {
|
||||
const path = `${this.basePath}/${id}/overhead`;
|
||||
return await httpClient<BaseApiResponse<ClosingOverhead>>(path, {
|
||||
method: 'GET',
|
||||
});
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<ClosingOverhead>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const ClosingApi = new ClosingApiService('/closings');
|
||||
|
||||
Reference in New Issue
Block a user