mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 23:05:46 +00:00
feat(FE): Support fetching HPP ekspedisi by kandang
This commit is contained in:
@@ -40,8 +40,18 @@ const ClosingDetailPage = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { data: hppEkspedisiData, isLoading: isLoadingHppEkspedisi } = useSWR(
|
const { data: hppEkspedisiData, isLoading: isLoadingHppEkspedisi } = useSWR(
|
||||||
closingId ? `hpp-ekspedisi-${closingId}` : null,
|
kandangId
|
||||||
() => ClosingApi.getHppEkspedisi(Number(closingId))
|
? `hpp-ekspedisi-${closingId}-${kandangId}`
|
||||||
|
: closingId
|
||||||
|
? `hpp-ekspedisi-${closingId}`
|
||||||
|
: null,
|
||||||
|
() =>
|
||||||
|
kandangId
|
||||||
|
? ClosingApi.getHppEkspedisiByKandang(
|
||||||
|
Number(closingId),
|
||||||
|
Number(kandangId)
|
||||||
|
)
|
||||||
|
: ClosingApi.getHppEkspedisi(Number(closingId))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!closingId) {
|
if (!closingId) {
|
||||||
|
|||||||
@@ -162,6 +162,23 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getHppEkspedisiByKandang(
|
||||||
|
closingId: number,
|
||||||
|
kandangId: number
|
||||||
|
): Promise<BaseApiResponse<ClosingHppExpedition> | undefined> {
|
||||||
|
try {
|
||||||
|
const path = `${this.basePath}/${closingId}/${kandangId}/expedition-hpp`;
|
||||||
|
return await httpClient<BaseApiResponse<ClosingHppExpedition>>(path, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
if (axios.isAxiosError<BaseApiResponse<ClosingHppExpedition>>(error)) {
|
||||||
|
return error.response?.data;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ClosingApi = new ClosingApiService('/closings');
|
export const ClosingApi = new ClosingApiService('/closings');
|
||||||
|
|||||||
Reference in New Issue
Block a user