feat: tambah pengecekan isActive dan bersihkan cache saat logout
- Tampilkan Alert jika admin menonaktifkan akun user yang sedang login - Clear React Query cache saat signOut agar data akun lama tidak bocor ke sesi berikutnya Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,7 +16,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { LinearGradient } from "expo-linear-gradient";
|
||||
import { Stack } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Dimensions, Platform, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { Alert, Dimensions, Platform, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
@@ -55,6 +55,16 @@ export default function Home() {
|
||||
}
|
||||
}, [isError, signOut])
|
||||
|
||||
useEffect(() => {
|
||||
if (profile && profile.isActive === false) {
|
||||
Alert.alert(
|
||||
'Akun Dinonaktifkan',
|
||||
'Akun kamu telah dinonaktifkan. Silahkan hubungi admin untuk informasi lebih lanjut.',
|
||||
[{ text: 'OK', onPress: signOut }]
|
||||
)
|
||||
}
|
||||
}, [profile, signOut])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
// Invalidate all queries related to the home screen
|
||||
|
||||
Reference in New Issue
Block a user