import { AlertDefaultSystem, AvatarUsernameAndOtherComponent, BaseBox, BoxButtonOnFooter, BoxWithHeaderSection, ButtonCustom, NewWrapper, StackCustom, TextCustom, } from "@/components"; import AvatarAndBackground from "@/screens/Profile/AvatarAndBackground"; import { apiGetBlockedById, apiUnblock, } from "@/service/api-client/api-blocked"; import { router, useLocalSearchParams } from "expo-router"; import _ from "lodash"; import { useEffect, useState } from "react"; export default function ProfileDetailBlocked() { const { id } = useLocalSearchParams(); const [data, setData] = useState(null); const [isLoading, setIsLoading] = useState(false); useEffect(() => { fetchData(); }, [id]); const fetchData = async () => { const response = await apiGetBlockedById({ id: String(id) }); // console.log("[RESPONSE >>]", JSON.stringify(response, null, 2)); setData(response.data); }; const handleSubmit = async () => { try { setIsLoading(true); await apiUnblock({ id: String(id) }); router.back(); } catch (error) { console.log("[ERROR >>]", JSON.stringify(error, null, 2)); } finally { setIsLoading(false); } }; return ( <> { AlertDefaultSystem({ title: "Buka Blokir", message: "Apakah anda yakin ingin membuka blokir ini?", textLeft: "Tidak", textRight: "Ya", onPressRight: () => { handleSubmit(); }, }); }} > Buka Blokir } > Jika anda membuka blokir ini maka semua postingan terkait user ini akan muncul kembali di beranda {" "} {_.upperCase(data?.menuFeature?.name)} ); }