I want to show the total number of connections I have using the API I created, but when I run with the mobile project, the results show only '0' and show this error message. It should automatically display the number of connections on the screen, I already tested it with the web application and it works, the problem persists only in the mobile version. In the api.ts file the URL is in this format because I am simulating the mobile application on an iOS device with a DevTools connection through the Tunnel.
My api.ts for connetion with api
import axios from "axios";const api = axios.create({ baseURL: "http://y7-xkq.anonymous.mobile.exp.direct:3333",});export default api;
const [totalConnections, setTotalConnections] = useState(0); useEffect(() => { api.get("connections").then((response) => { // console.log(response); const { total } = response.data; setTotalConnections(total); }); }, []);
<Text style={styles.totalConnections}> Total de {totalConnections} conexões já realizadas{" "}<Image source={heartIcon} /></Text>