mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-22 06:15:47 +00:00
refactor(FE): Refactor sales data fetching and component structure
This commit is contained in:
@@ -34,18 +34,6 @@ const ClosingDetailPage = () => {
|
||||
() => ProjectFlockKandangApi.getSingle(Number(kandangId))
|
||||
);
|
||||
|
||||
const { data: salesData, isLoading: isLoadingSales } = useSWR(
|
||||
kandangId
|
||||
? `sales-${closingId}-${kandangId}`
|
||||
: closingId
|
||||
? `sales-${closingId}`
|
||||
: null,
|
||||
() =>
|
||||
kandangId
|
||||
? ClosingApi.getPenjualanByKandang(Number(closingId), Number(kandangId))
|
||||
: ClosingApi.getPenjualan(Number(closingId))
|
||||
);
|
||||
|
||||
if (!closingId) {
|
||||
router.back();
|
||||
|
||||
@@ -62,10 +50,7 @@ const ClosingDetailPage = () => {
|
||||
}
|
||||
|
||||
const isLoading =
|
||||
isLoadingClosing ||
|
||||
isLoadingSales ||
|
||||
isLoadingProject ||
|
||||
isLoadingKandang;
|
||||
isLoadingClosing || isLoadingProject || isLoadingKandang;
|
||||
|
||||
return (
|
||||
<div className='w-full p-4 flex flex-row justify-center'>
|
||||
@@ -75,7 +60,6 @@ const ClosingDetailPage = () => {
|
||||
<ClosingDetail
|
||||
id={Number(closingId)}
|
||||
initialValue={closing.data}
|
||||
salesData={isResponseSuccess(salesData) ? salesData.data : undefined}
|
||||
projectData={
|
||||
isResponseSuccess(projectData) ? projectData.data : undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user