Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

318
Visualizações
Network request failed in react native fetch

i was working on this project yesterday and i close it and was working fine , i come today and run it , it gives me network failed i dont know why is that i try some way to fix it but it does not work . if any one can help that will be so helpful . by the way the app is working to i click the login .

i tried to delete node_moudle . i tried from another phone . i tried to delete the app from the device and restart it . class Loginscreen extends Component {

    // Setting up Login Activity title.
    static navigationOptions =
     {
        title: 'Loginscreen',
     };

  constructor(props) {
      super(props)
      this.getData();
      this.state = {
        UserEmail: '',
        UserPassword: ''
      }
    }


  UserLoginFunction = () =>{
    
   const { UserEmail }  = this.state ;
   const { UserPassword }  = this.state ;

   //the api is working i test it 
  fetch('https://hub.0000.com/users/User_Login.php', {


    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      email: UserEmail,
      password: UserPassword
    })
   
  }).then((response) => response.json())
        .then((responseJson) => {
          const {message, userData} = responseJson;
          
          if (typeof message === "string" && message.toLowerCase().trim() === "data matched") {
            this.props.navigation.navigate("Homescreen", { userData });
            AsyncStorage.setItem('userName', JSON.stringify(responseJson.userData));
            this.onSumbit();
            console.log(responseJson.userData);
            } else {
            Alert.alert("Error:", responseJson.message);
            }
        }).catch((error) => {
          console.error(error);
        });
    }
    
    onSumbit = async () => {
      try{
      
        await AsyncStorage.setItem('UserEmail',this.state.UserEmail)
      }catch (err){
        console.log(err)
      }
    }

    getData = async () => {
      try {
        const UserEmail = await AsyncStorage.getItem('UserEmail')
        if(UserEmail !== null) {
          this.setState({ UserEmail })
          console.log(UserEmail);
        }
      } catch(e) {
        // error reading value
      }
    }
    render() {
  

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda