fix investasi

This commit is contained in:
2025-02-28 06:46:37 +08:00
parent d30be5b19d
commit 0fcf1d5b5e
6 changed files with 38 additions and 34 deletions

View File

@@ -54,7 +54,6 @@ export default function MainCrowd() {
// color: "gray",
}}
onClick={() => {
setLoadingInv(true);
router.push(RouterCrowd.investasi, { scroll: false });
setChangeColor(0);
}}
@@ -94,13 +93,8 @@ export default function MainCrowd() {
color: MainColor.white,
}}
onClick={() => {
setLoadingDon(true);
router.push(RouterCrowd.donasi, { scroll: false });
setDonasiHotMenu(0);
// ComponentGlobal_NotifikasiPeringatan(
// "Sementara ini sedang maintenance",
// 3000
// );
}}
>
<Grid>

View File

@@ -1,8 +1,6 @@
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
import { Affix, Button, Center, rem } from "@mantine/core";
import { useState } from "react";
import { investasi_funGetAllPublish } from "../../fun/get_all_investasi";
import { data } from "autoprefixer";
import { apiGetAllInvestasi } from "../../_lib/api_interface";
export function Investasi_ComponentButtonUpdateBeranda({

View File

@@ -15,6 +15,8 @@ import { Investasi_ComponentCardBerandaNew } from "../../_component/main/com_car
import { apiGetAllInvestasi } from "../../_lib/api_interface";
import { IDataInvestasiBursa } from "../../_lib/type_investasi";
import SkeletonInvestasiBursa from "./skeleton_beranda";
import frontendLogger from "@/util/frontendLogger";
import { clientLogger } from "@/util/clientLogger";
export function Investasi_ViewBerandaNew() {
const [data, setData] = useState<IDataInvestasiBursa[]>([]);
@@ -33,6 +35,12 @@ export function Investasi_ViewBerandaNew() {
}
}, [isTriggerReload]);
useShallowEffect(() => {
setIsTriggerReload(false);
setIsShowUpdate(false);
getDataInvestasi();
}, []);
async function getDataInvestasi() {
try {
setLoading(true);
@@ -47,11 +55,21 @@ export function Investasi_ViewBerandaNew() {
}
}
useShallowEffect(() => {
setIsTriggerReload(false);
setIsShowUpdate(false);
getDataInvestasi();
}, []);
const handleMoreData = async () => {
try {
const pageNew = activePage + 1;
const loadData = await apiGetAllInvestasi(`?cat=bursa&page=${pageNew}`);
if (loadData.success) {
setActivePage(pageNew);
return loadData.data;
} else {
return [];
}
} catch (error) {
clientLogger.error("Error ", error);
return [];
}
};
return (
<>
@@ -80,15 +98,7 @@ export function Investasi_ViewBerandaNew() {
)}
data={data}
setData={setData}
moreData={async () => {
const pageNew = activePage + 1;
const loadData = await apiGetAllInvestasi(
`?cat=bursa&page=${pageNew}`
);
setActivePage(pageNew);
return loadData.data as any;
}}
moreData={handleMoreData}
>
{(item) => <Investasi_ComponentCardBerandaNew data={item as any} />}
</ScrollOnly>