Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Json response reactnative fetch login data

import {Alert} from 'react-native'

login = () => {
    if (this.state.username === '') {
      Alert.alert('Enter username !')
    } else if (this.state.password === '') {
      Alert.alert('Enter Password !')
    } else {
      api
        .createUser(this.state.username, this.state.password)
        .then((response) => {
            if(response.ok) {
              Alert.alert('Login successful')
            }else{
              Alert.alert('Check credentials')
            }
        })
        //If response is in json then in success
        
        //If response is not in json then in error
        .catch((error) => {
          //Error
          Alert.alert('Check credentials')
        })
    }
  }
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to query a button with specific text with react native testing library 
Javascript :: React Native Root Element, deciding on async call 
Javascript :: Display all posts from database 
Javascript :: Delete a field from Firebase Firestore where the field/key has a period/punctuation (".") - modular v9 JavaScript SDK 
Javascript :: how to edit data retrieval using jsp 
Javascript :: context Menus 
Javascript :: Scaling elements proportionally using CSS and JQUERY 
Javascript :: chain underscore 
Javascript :: JSON.stringify on Arrays adding numeric keys for each array value 
Javascript :: sending api with limited fields in express 
Javascript :: Special Chars like DOTS in Express.js route 
Javascript :: jquery call service 
Javascript :: Alternative Bind() Syntax For JavaScript 
Javascript :: varibale as listeneres javascirpit 
Javascript :: “Line Splicing in C++” 
Javascript :: javasrccipt loop array 
Javascript :: Setting Multiples Properties With Array 
Javascript :: yoptascript 
Javascript :: removevalidators angular 
Javascript :: js a || b 
Javascript :: Object.entries() For A JSON 
Javascript :: change dir npm run build 
Javascript :: true type of javascript 
Javascript :: todo app html css javascript 
Javascript :: leetcode solution problem 66 plus one 
Javascript :: backbone view 
Javascript :: climbing stairs 
Javascript :: How to fix prettier messing up your HTML on save 
Javascript :: javascript get max value in array of objects 
Javascript :: new react 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =