upd: refresh division detail home

Deskripsi:
- refresh load pada halaman home detail division

No Issues
This commit is contained in:
2025-09-09 11:57:33 +08:00
parent 060f96e7b2
commit d20307fc0b
6 changed files with 62 additions and 27 deletions

View File

@@ -24,7 +24,7 @@ type Props = {
idStorage: string
}
export default function FileDivisionDetail() {
export default function FileDivisionDetail({ refreshing }: { refreshing: boolean }) {
const ref = React.useRef<ICarouselInstance>(null);
const width = Dimensions.get("window").width;
const [data, setData] = useState<Props[]>([])
@@ -33,9 +33,9 @@ export default function FileDivisionDetail() {
const [loading, setLoading] = useState(true)
const [loadingOpen, setLoadingOpen] = useState(false)
async function handleLoad() {
async function handleLoad(loading: boolean) {
try {
setLoading(true)
setLoading(loading)
const hasil = await decryptToken(String(token?.current))
const response = await apiGetDivisionOneFeature({ user: hasil, id, cat: 'new-file' })
setData(response.data)
@@ -47,7 +47,12 @@ export default function FileDivisionDetail() {
}
useEffect(() => {
handleLoad()
if (refreshing)
handleLoad(false)
}, [refreshing])
useEffect(() => {
handleLoad(true)
}, [])