diff --git a/app/(application)/banner/index.tsx b/app/(application)/banner/index.tsx index 2e9513e..b980fdd 100644 --- a/app/(application)/banner/index.tsx +++ b/app/(application)/banner/index.tsx @@ -5,6 +5,7 @@ import ButtonBackHeader from "@/components/buttonBackHeader" import DrawerBottom from "@/components/drawerBottom" import MenuItemRow from "@/components/menuItemRow" import ModalLoading from "@/components/modalLoading" +import Text from "@/components/Text" import { ConstEnv } from "@/constants/ConstEnv" import Styles from "@/constants/Styles" import { apiDeleteBanner, apiGetBanner } from "@/lib/api" @@ -121,26 +122,36 @@ export default function BannerList() { } style={[Styles.h100]} > - - {entities.map((index: any, key: number) => ( - { - setDataId(index.id) - setSelectFile(index) - setModal(true) - }} - borderType="all" - icon={ - 0 + ? + + {entities.map((index: any, key: number) => ( + { + setDataId(index.id) + setSelectFile(index) + setModal(true) + }} + borderType="all" + icon={ + + } + title={index.title} /> - } - title={index.title} - /> - ))} - + ))} + + : + + Tidak ada data + + } + + setModal(false)} title="Menu"> diff --git a/components/home/carouselHome.tsx b/components/home/carouselHome.tsx index e03fcc6..2ce9e3a 100644 --- a/components/home/carouselHome.tsx +++ b/components/home/carouselHome.tsx @@ -9,6 +9,7 @@ import { Dimensions, Image, View } from "react-native"; import { useSharedValue } from "react-native-reanimated"; import Carousel, { ICarouselInstance } from "react-native-reanimated-carousel"; import { useDispatch, useSelector } from "react-redux"; +import Text from "../Text"; export default function CaraouselHome() { const { decryptToken, token } = useAuthSession() @@ -21,7 +22,13 @@ export default function CaraouselHome() { async function handleBannerView() { const hasil = await decryptToken(String(token?.current)) - apiGetBanner({ user: hasil }).then((data) => dispatch(setEntities(data.data))) + apiGetBanner({ user: hasil }).then((data) => { + if (data.data.length > 0) { + dispatch(setEntities(data.data)) + } else { + dispatch(setEntities([])) + } + }) } async function handleUser() { @@ -40,22 +47,30 @@ export default function CaraouselHome() { return ( - ( - 0 ? + ( + + )} /> - )} - /> + : + + BANNER + + } + ) } \ No newline at end of file