/* eslint-disable react-hooks/exhaustive-deps */ import { BaseBox, Grid, LoaderCustom, ProgressCustom, Spacing, StackCustom, TextCustom, ViewWrapper, } from "@/components"; import NoDataText from "@/components/_ShareComponent/NoDataText"; import { useAuth } from "@/hooks/use-auth"; import { apiInvestmentGetAll } from "@/service/api-client/api-investment"; import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay"; import { router, useFocusEffect } from "expo-router"; import _ from "lodash"; import React, { useCallback, useState } from "react"; import { View } from "react-native"; export default function InvestmentMyHolding() { const { user } = useAuth(); const [list, setList] = useState(null); const [loadingList, setLoadingList] = useState(false); useFocusEffect( useCallback(() => { onLoadList(); }, [user?.id]) ); const onLoadList = async () => { try { setLoadingList(true); const response = await apiInvestmentGetAll({ category: "my-holding", authorId: user?.id, }); console.log("[DATA LIST]", JSON.stringify(response.data, null, 2)); setList(response.data); } catch (error) { console.log("[ERROR]", error); } finally { setLoadingList(false); } }; return ( {loadingList ? ( ) : _.isEmpty(list) ? ( ) : ( list?.map((item, index) => ( router.push(`/investment/${item?.id}/(my-holding)/${item?.id}`) } > {item?.title} Rp. {formatCurrencyDisplay(item?.nominal)} {item?.lembarTerbeli} Lembar )) )} ); }