upd: kataloh
deskripsi: - update api list portofolio No Issues
This commit is contained in:
@@ -10,6 +10,7 @@ import Portofolio_EditMedsosBisnis from "./edit/medsos/ui_edit_medsos";
|
||||
import LayoutPortofolio_EditDataBisnis from "./edit/data/layout";
|
||||
import LayoutPortofolio_EditLogoBisnis from "./edit/logo/layout";
|
||||
import LayoutPortofolio_EditMedsosBisnis from "./edit/medsos/layout";
|
||||
import ListDetailPortofolioNew from './view/list_detail_portofolio_new';
|
||||
|
||||
export {
|
||||
CreatePortofolio,
|
||||
@@ -22,8 +23,9 @@ export {
|
||||
LayoutPortofolio_EditDataBisnis,
|
||||
LayoutPortofolio_EditLogoBisnis,
|
||||
LayoutPortofolio_EditMedsosBisnis,
|
||||
apiGetPortofolioByProfile
|
||||
apiGetPortofolioByProfile,
|
||||
};
|
||||
export type { IListPortofolio };
|
||||
export { Portofolio_ViewListDetail } from "./view/view_list_detail_portofolio";
|
||||
export { ListDetailPortofolioNew }
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import { ComponentPortofolio_DaftarBoxView } from "../component/card_view_daftar";
|
||||
import { portofolio_funGetAllDaftarByid } from "../fun/get/get_all_portofolio";
|
||||
import { MODEL_PORTOFOLIO } from "../model/interface";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { apiGetPortofolioByProfile } from "../lib/api_portofolio";
|
||||
|
||||
export default function Portofolio_UiListDetailNew() {
|
||||
const param = useParams<{ id: string }>()
|
||||
const profileId = param.id
|
||||
const [data, setData] = useState<MODEL_PORTOFOLIO[]>([])
|
||||
const [activePage, setActivePage] = useState(1)
|
||||
|
||||
async function getPortofolio() {
|
||||
try {
|
||||
const response = await apiGetPortofolioByProfile(`?profile=${param.id}&cat=portofolio&page=1`)
|
||||
if (response.success) {
|
||||
setData(response.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
useShallowEffect(() => {
|
||||
getPortofolio()
|
||||
}, []);
|
||||
|
||||
return <>
|
||||
<Box py={5}>
|
||||
<ScrollOnly
|
||||
height="90vh"
|
||||
renderLoading={() => (
|
||||
<Center mt={"lg"}>
|
||||
<ComponentGlobal_Loader />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await portofolio_funGetAllDaftarByid({
|
||||
profileId,
|
||||
page: activePage + 1,
|
||||
});
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => <ComponentPortofolio_DaftarBoxView data={item} />}
|
||||
</ScrollOnly>
|
||||
</Box>
|
||||
</>;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
'use client'
|
||||
import { UIGlobal_LayoutHeaderTamplate, UIGlobal_LayoutTamplate } from "@/app_modules/_global/ui";
|
||||
import Portofolio_UiListDetailNew from "../ui/ui_list_detail_portofolio_new";
|
||||
|
||||
export default function ListDetailPortofolioNew() {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate header={<UIGlobal_LayoutHeaderTamplate title="Daftar Portofolio" />} >
|
||||
<Portofolio_UiListDetailNew />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -17,7 +17,7 @@ export default function ListPortofolioProfileNew() {
|
||||
async function getPortofolio() {
|
||||
try {
|
||||
setLoading(true)
|
||||
const response = await apiGetPortofolioByProfile(`?profile=${param.id}&page=profile`)
|
||||
const response = await apiGetPortofolioByProfile(`?profile=${param.id}&cat=profile`)
|
||||
if (response.success) {
|
||||
setDataPortofolio(response.data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user