upd: scroll load
Deskripsi: - list anggota - list diskusi umum - list pengumuman No Issues
This commit is contained in:
@@ -9,6 +9,8 @@ import AlertKonfirmasi from "../alertKonfirmasi"
|
||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||
import DrawerBottom from "../drawerBottom"
|
||||
import MenuItemRow from "../menuItemRow"
|
||||
import { useDispatch, useSelector } from "react-redux"
|
||||
import { setUpdateMember } from "@/lib/memberSlice"
|
||||
|
||||
type Props = {
|
||||
active: any,
|
||||
@@ -18,17 +20,23 @@ type Props = {
|
||||
export default function HeaderRightMemberDetail({ active, id }: Props) {
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const [isVisible, setVisible] = useState(false)
|
||||
const update = useSelector((state: any) => state.memberUpdate)
|
||||
const dispatch = useDispatch()
|
||||
|
||||
async function handleActive() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiDeleteUser({ user: hasil, isActive: active }, id)
|
||||
if (response.success) {
|
||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
||||
dispatch(setUpdateMember(!update))
|
||||
} else {
|
||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setVisible(false)
|
||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
||||
router.replace(`/member/${id}`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user