mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
refactor(FE-363): Replace LogisticService with LogisticApi instance
This commit is contained in:
@@ -2,18 +2,12 @@ import { BaseApiService } from '@/services/api/base';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
import { LogisticPurchasePerSupplierReport } from '@/types/api/report/logistic-stock';
|
||||
|
||||
const baseLogisticApi = new BaseApiService<
|
||||
LogisticPurchasePerSupplierReport,
|
||||
unknown,
|
||||
unknown
|
||||
>('/reports');
|
||||
|
||||
export class LogisticApi extends BaseApiService<
|
||||
export class LogisticApiService extends BaseApiService<
|
||||
LogisticPurchasePerSupplierReport,
|
||||
unknown,
|
||||
unknown
|
||||
> {
|
||||
constructor(basePath: string = '') {
|
||||
constructor(basePath: string) {
|
||||
super(basePath);
|
||||
}
|
||||
|
||||
@@ -43,33 +37,4 @@ export class LogisticApi extends BaseApiService<
|
||||
}
|
||||
}
|
||||
|
||||
export const LogisticService = {
|
||||
basePath: baseLogisticApi.basePath,
|
||||
header: baseLogisticApi.header,
|
||||
getAllFetcher: baseLogisticApi.getAllFetcher.bind(baseLogisticApi),
|
||||
getSingle: baseLogisticApi.getSingle.bind(baseLogisticApi),
|
||||
create: baseLogisticApi.create.bind(baseLogisticApi),
|
||||
update: baseLogisticApi.update.bind(baseLogisticApi),
|
||||
delete: baseLogisticApi.delete.bind(baseLogisticApi),
|
||||
customRequest: baseLogisticApi.customRequest.bind(baseLogisticApi),
|
||||
|
||||
// Custom method for specific endpoint
|
||||
getLogisticStockReport: (
|
||||
area_id?: number,
|
||||
supplier_id?: number,
|
||||
product_id?: number,
|
||||
received_date?: string,
|
||||
po_date?: string,
|
||||
start_date?: string,
|
||||
end_date?: string
|
||||
) =>
|
||||
new LogisticApi().getLogisticStockReport(
|
||||
area_id,
|
||||
supplier_id,
|
||||
product_id,
|
||||
received_date,
|
||||
po_date,
|
||||
start_date,
|
||||
end_date
|
||||
),
|
||||
};
|
||||
export const LogisticApi = new LogisticApiService('/reports');
|
||||
|
||||
Reference in New Issue
Block a user