import { useEffect, useState } from 'react' import { FlatList, RefreshControl, Text, View } from 'react-native' import { useNavigation } from '@react-navigation/native'; import { Card } from '../../components/Card' import { CardList } from '../../components/cardList/CardList' import { Button } from '../../components/Button' import { useFetchWithAuth } from '../../hooks/useFetchWithAuth' export const SalesOrderListScreen = () => { const navigation = useNavigation(); const [refreshing, setRefreshing] = useState(false); const endpoints = "pedido"; let defaultData: [] = []; const [entities, setEntities] = useState(defaultData); const getInitData = async () => { const { data, error } = await useFetchWithAuth(endpoints); if (!error) { setEntities(data); } else { console.log(error) } } useEffect(() => { getInitData(); }, [refreshing]) const onRefresh = () => { setRefreshing(true); setTimeout(() => { setRefreshing(false); }, 1000); }; return (