mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat(FE): Closing Finance and adjust reports expense filter request
This commit is contained in:
@@ -3,6 +3,7 @@ import axios from 'axios';
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import {
|
||||
Closing,
|
||||
ClosingFinance,
|
||||
ClosingGeneralInformation,
|
||||
ClosingIncomingSapronak,
|
||||
ClosingOutgoingSapronak,
|
||||
@@ -21,6 +22,7 @@ import {
|
||||
} from '@/dummy/closing.dummy';
|
||||
import { httpClient, httpClientFetcher } from '@/services/http/client';
|
||||
import { ClosingSales } from '@/types/api/closing';
|
||||
import { dummyGetOneClosingFinance } from '@/dummy/json/closing-finance.dummy';
|
||||
|
||||
export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||
constructor(basePath: string) {
|
||||
@@ -193,6 +195,26 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async getFinance(
|
||||
id: number
|
||||
): Promise<BaseApiResponse<ClosingFinance> | undefined> {
|
||||
// TODO: Remove this block when backend is ready
|
||||
// return dummyGetOneClosingFinance(id);
|
||||
|
||||
// Uncomment this when backend is ready
|
||||
try {
|
||||
const path = `${this.basePath}/${id}/finance`;
|
||||
return await httpClient<BaseApiResponse<ClosingFinance>>(path, {
|
||||
method: 'GET',
|
||||
});
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<ClosingFinance>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const ClosingApi = new ClosingApiService('/closings');
|
||||
|
||||
Reference in New Issue
Block a user